Click here to Skip to main content
15,909,466 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralDOC pointer to APP? HELP! Pin
Obi-Wan-Kenobi11-Feb-03 18:58
Obi-Wan-Kenobi11-Feb-03 18:58 
GeneralRe: DOC pointer to APP? HELP! Pin
Chris Losinger11-Feb-03 19:43
professionalChris Losinger11-Feb-03 19:43 
GeneralRe: DOC pointer to APP? HELP! Pin
Obi-Wan-Kenobi11-Feb-03 19:59
Obi-Wan-Kenobi11-Feb-03 19:59 
Generalloading .chm help file with vc++ Pin
trustno111-Feb-03 17:41
trustno111-Feb-03 17:41 
GeneralRe: loading .chm help file with vc++ Pin
HENDRIK R11-Feb-03 21:54
HENDRIK R11-Feb-03 21:54 
GeneralRe: loading .chm help file with vc++ Pin
trustno112-Feb-03 11:56
trustno112-Feb-03 11:56 
GeneralRe: loading .chm help file with vc++ Pin
HENDRIK R12-Feb-03 21:10
HENDRIK R12-Feb-03 21:10 
GeneralStatic Members, etc Pin
BigDaddyDrew11-Feb-03 14:49
sussBigDaddyDrew11-Feb-03 14:49 
Hi guys/gals,

I'm writing a class which has a pair of static ints. Pretty easy, I know...I've done this before, but it's not working right now. I'm getting the linker error for unresolved external symbols. Perhaps you'll have some ideas:

main.cpp

#include<iostream> // iostream
#include<fstream>  // fstream
#include<vector>   // vector
//#include<unistd.h>
#include"job.h"

//void parseCommandLine(int, char**, char*&, char*&, char*&, bool&)

int main(int argc, char** argv)
{
    char *algor = "Recursive", *cacheFile = "testcase1.txt", *schedFile = "schedule.txt";
    bool helpFlag = false;
    int tempMachPerJob, tempNumOfMach, i;
    Job tempJob;
    vector<Job> jobs;

    //parseCommandLine(argc, argv, algor, cacheFile, schedFile, helpFlag);

    ifstream inFile(cacheFile);
    if (inFile.fail())
    {
        cout << "Error opening input file!" << endl;
        exit(1);
    }

    inFile >> tempMachPerJob >> tempNumOfMach;
    
    Job::setMachPerJob(tempMachPerJob);
    Job::setNumOfMach(tempNumOfMach);
    

    inFile >> tempJob;
    while (inFile)
    {
        jobs.push_back(tempJob);
        inFile >> tempJob;
    }

    for(i = 0; i < jobs.size(); i++)
        cout << jobs[i] << endl;

    return 0;
}

job.h

#ifndef JOB_H
#define JOB_H

#include<iostream> // iostream
#include<vector>   // vector

using namespace std;

class Job
{
private:
    static int machPerJob, numOfMach;
    int startTime, endTime;
    vector<char> machines;
    char schedule;
    
public:
    Job();
    Job(int, int, vector<char>);
    static void setMachPerJob(int);
    static int getMachPerJob();
    static void setNumOfMach(int);
    void setSchedule(char sched);
    friend ostream& operator<<(ostream& os, const Job& job);    
    friend istream& operator>>(istream& is, Job& job);
};

#endif

job.cpp

#include<vector> // vector
#include"job.h"

using namespace std;

Job::Job()
{
    startTime = endTime = -1;
    schedule = '-';
}

Job::Job(int start, int end, vector<char> mach)
{
    startTime = start;
    endTime = end;
    machines = mach;
    schedule = '-';
}

void Job::setMachPerJob(int mpj)
{
    machPerJob = mpj;
}

int Job::getMachPerJob()
{
    return machPerJob;
}

void Job::setNumOfMach(int nom)
{
    numOfMach = nom;
}

void Job::setSchedule(char sched)
{
    schedule = sched;
}
    
ostream& operator << (ostream& os, const Job& job)
{
    os << job.startTime << " " << job.endTime << " " << job.schedule;
    return os;
}

istream& operator >> (istream& is, Job& job)
{
    int start, end;
    char tempMach;
    is >> start >> end;
    job.startTime = start;
    job.endTime = end;
    for (int i = 0; i < Job::getMachPerJob(); i++)
    {
        is >> tempMach;
        job.machines.push_back(tempMach);
    }
    return is;
}

GeneralRe: Static Members, etc Pin
Chris Losinger11-Feb-03 15:14
professionalChris Losinger11-Feb-03 15:14 
GeneralRe: Static Members, etc Pin
11-Feb-03 15:21
suss11-Feb-03 15:21 
GeneralRe: Static Members, etc Pin
Anonymous11-Feb-03 15:39
Anonymous11-Feb-03 15:39 
GeneralRe: Static Members, etc Pin
Kant11-Feb-03 15:44
Kant11-Feb-03 15:44 
GeneralWriting Files Pin
orcblood11-Feb-03 13:44
orcblood11-Feb-03 13:44 
GeneralRe: Writing Files Pin
MAAK11-Feb-03 23:24
MAAK11-Feb-03 23:24 
GeneralRe: Writing Files Pin
orcblood12-Feb-03 10:58
orcblood12-Feb-03 10:58 
GeneralRe: Writing Files Pin
MAAK12-Feb-03 13:58
MAAK12-Feb-03 13:58 
GeneralCustom Dialogs Pin
orcblood11-Feb-03 13:40
orcblood11-Feb-03 13:40 
GeneralRe: Custom Dialogs Pin
PJ Arends11-Feb-03 13:47
professionalPJ Arends11-Feb-03 13:47 
GeneralRe: Custom Dialogs Pin
orcblood11-Feb-03 14:26
orcblood11-Feb-03 14:26 
GeneralRe: Custom Dialogs Pin
PJ Arends11-Feb-03 15:07
professionalPJ Arends11-Feb-03 15:07 
Generalwindow background Pin
Perseus11-Feb-03 13:09
Perseus11-Feb-03 13:09 
GeneralRe: window background Pin
HENDRIK R11-Feb-03 21:22
HENDRIK R11-Feb-03 21:22 
QuestionModeless Dialog Doesn't Destroy During WM_CLOSE? Pin
Dan Wilson11-Feb-03 11:19
Dan Wilson11-Feb-03 11:19 
AnswerRe: Modeless Dialog Doesn't Destroy During WM_CLOSE? Pin
Joaquín M López Muñoz11-Feb-03 11:26
Joaquín M López Muñoz11-Feb-03 11:26 
GeneralRe: Modeless Dialog Doesn't Destroy During WM_CLOSE? Pin
Dan Wilson12-Feb-03 3:23
Dan Wilson12-Feb-03 3:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.