public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* How to specify libraries for the linker
@ 2003-12-04 15:08 ceklund
  0 siblings, 0 replies; 2+ messages in thread
From: ceklund @ 2003-12-04 15:08 UTC (permalink / raw)
  To: gcc-help

Hi,

I`m trying to link my Test.o file to exe file, but the linker 
can`t find any libraries. I think it want`s the standard library.

1. I compiled my Test.cpp file -> OK
2. in the same directory I tried the following:
   gcc -o Test.exe Test.o

-> output:

------
..
Test.o(.text+0xf):Test.cpp: undefined reference to `operator new(unsigned
long)'
Test.o(.text+0x2e):Test.cpp: undefined reference to `operator delete(void*)'
Testi.o(.text+0x5e):Test.cpp: undefined reference to
`std::ios_base::Init::Init()'
Test.o(.text+0xbc):Test.cpp: undefined reference to
`std::ios_base::Init::~Init()'
Test.o(.gnu.linkonce.t._ZN5Testi7printEv+0xf):Test.cpp: undefined reference to
`std::cout'
..
------


I tried to use the -l and -L flags but I dont know what to put after that,
because I dont`t know what libraries I need and where do they reside (\lib
??).

Could somebody be so kind to help me. I`d need to know how to
do the job and tell me what libraries I need for standard C++ programs.

regards,

-mark

^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: How to specify libraries for the linker
@ 2003-12-04 17:18 lrtaylor
  0 siblings, 0 replies; 2+ messages in thread
From: lrtaylor @ 2003-12-04 17:18 UTC (permalink / raw)
  To: gcc-help

Link your program with g++ instead of gcc.  C++ program should always be
linked using g++.

Cheers,
Lyle

-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
Behalf Of ceklund@mail.student.oulu.fi

Hi,

I`m trying to link my Test.o file to exe file, but the linker 
can`t find any libraries. I think it want`s the standard library.

1. I compiled my Test.cpp file -> OK
2. in the same directory I tried the following:
   gcc -o Test.exe Test.o

mark

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-12-04 17:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-04 15:08 How to specify libraries for the linker ceklund
2003-12-04 17:18 lrtaylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).