This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
c++ compilation error (undefined reference)
- From: Baraclese <webmaster at baraclese dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Mon, 28 Oct 2002 01:48:11 +0100
- Subject: c++ compilation error (undefined reference)
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