Possible Duplicate:
What is an undefined reference/unresolved external symbol error and how do I fix it?
Someone wants to save me some time on how classes and constructors work in c++ ? This is what I got - it do not work. I want to the class to have an constructor that takes a filename and reads a file with that name from the filesystem.
this is the header and implementation
#ifndef __narcissism__Histogram__
#define __narcissism__Histogram__
#include <iostream>
#include <sstream> // for ostringstream
#include <iomanip> // for setw, setfill
#include <ios> // for hex stream manipulator
using namespace std;
#include "random.h" // for randomInteger
#include "strlib.h" // for integerToString
#include "error.h" // for error
class Histogram {
public:
/** Constructor:
*
* */
Histogram(string filename)
{
readfile(filename);
}
private:
int readfile(string filename);
};
#endif /* defined(__narcissism__Histogram__) */
*.cpp
#include "Histogram.h"
int readfile(string filename)
{
return 0;
}
Error msg:
Undefined symbols for architecture i386:
"Histogram::readfile(std::string)", referenced from:
Histogram::Histogram(std::string) in narcissism.o
ld: symbol(s) not found for architecture i386