[arch-general] C++ program compiliation failed

Nilesh Govindarajan lists at itech7.com
Sun Nov 14 18:59:28 CET 2010


Hi,
I have three c++ files: main.cpp, and querystring.{h,cpp}

querystring.h contains the definition for the QueryString class
and querystring.cpp contains the implementation.

querystring.cpp and main.cpp both have the statement #include "querystring.h"

Now when I run the compiler, I get a weird error-

$ g++ main.cpp querystring.cpp -o out
/tmp/ccxJ7C28.o: In function `main':
main.cpp:(.text+0x3e): undefined reference to `QueryString::QueryString()'
collect2: ld returned 1 exit status

How am I supposed to compile the program? i.e. in general a multifile
program having .hs and .cpps

-- 
Regards,
Nilesh Govindarajan
Facebook: http://www.facebook.com/nilesh.gr
Twitter: http://twitter.com/nileshgr
Website: http://www.itech7.com
VPS Hosting: http://www.itech7.com/a/vps


More information about the arch-general mailing list