Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Reply-To: Cygwin List Message-Id: <6.0.1.1.0.20040305141623.03d2af70@127.0.0.1> X-Sender: Date: Fri, 05 Mar 2004 14:18:05 -0500 To: Xavier Dufresne , cygwin AT cygwin DOT com From: Larry Hall Subject: Re: Undefined references when compiling C++ program In-Reply-To: <4048CE1D.30000@gmx.fr> References: <4048CE1D DOT 30000 AT gmx DOT fr> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" At 01:59 PM 3/5/2004, you wrote: >Hello, > >when I try to compile this... > >//zozo.cc >#include >int main() >{ > std::cout << "Salut" << std::endl; > return 0; >} > >...with... >gcc zozo.cc > >...gcc give me... >/cygdrive/c/DOCUME~1/travonz/LOCALS~1/Temp/ccuTTqP6.o(.text+0x2f):zozo.cc: undefined reference to `std::cout' >/cygdrive/c/DOCUME~1/travonz/LOCALS~1/Temp/ccuTTqP6.o(.text+0x34):zozo.cc: undefined reference to `std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*)' >/cygdrive/c/DOCUME~1/travonz/LOCALS~1/Temp/ccuTTqP6.o(.text+0x3c):zozo.cc: undefined reference to `std::basic_ostream >& std::endl >(std::basic_ostream >&)' >/cygdrive/c/DOCUME~1/travonz/LOCALS~1/Temp/ccuTTqP6.o(.text+0x44):zozo.cc: undefined reference to `std::basic_ostream >::operator<<(std::basic_ostream >& (*)(std::basic_ostream >&))' >/cygdrive/c/DOCUME~1/travonz/LOCALS~1/Temp/ccuTTqP6.o(.text+0x6d):zozo.cc: undefined reference to `std::ios_base::Init::Init[in-charge]()' >/cygdrive/c/DOCUME~1/travonz/LOCALS~1/Temp/ccuTTqP6.o(.text+0x88):zozo.cc: undefined reference to `std::ios_base::Init::~Init [in-charge]()' >collect2: ld returned 1 exit status > >if I compile: int main(){return 0;} it's ok ! > >Do I have to specifie linking libraries with the -l option ? Ugh! Did you think of checking the email archives? Do you realize this question is really not Cygwin-specific so it's off-topic? Anyway, use 'g++' to compile C++ source. -- Larry Hall http://www.rfk.com RFK Partners, Inc. (508) 893-9779 - RFK Office 838 Washington Street (508) 893-9889 - FAX Holliston, MA 01746 -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/