This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]