c++ compilation error (undefined reference)
Baraclese
webmaster@baraclese.com
Sun Oct 27 16:48:00 GMT 2002
Hi, I wrote a TGA header file and I wanted to test it with a small main
file.
tga.h looks something like this:
class TGA
{
public:
TGA();
TGA(char *filename);
~TGA();
bool load(char const *filename);
}
tga.cpp looks like this:
#include "tga.h"
using namespace std;
main()
{
TGA image;
cout << "Filename: ";
cin >> image.filename;
if (image.load(image.filename))
cout << "File successfully read./n";
return 0;
}
When compiling using gcc 3.2 I receive the following error message:
$ g++ -mno-cygwin -lstdc++ f:/projects/cpp/tga.cpp -o tga.exe
/cygdrive/c/WIN98/TEMP/cccSDKcK.o(.text+0x9f0):tga.cpp: undefined
reference to `TGA::TGA()'
What's the problem here?
regards,
Baraclese
More information about the Gcc-help
mailing list