Re: C++ program compiliation failed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On 14/11/10 17:59, Nilesh Govindarajan wrote:
> 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

This isn't really the right forum to ask a question like this.  My guess
would
be the order of the files on the command line, try

  $ g++ querystring.cpp main.cpp -o out

/M

-- 
Magnus Therning                        (OpenPGP: 0xAB4DFBA4)
magnus@therning.org           Jabber: magnus@therning.org
http://therning.org/magnus         identi.ca|twitter: magthe

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux