help-gplusplus
[Top][All Lists]
Advanced

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

Re: Loading & Linking Error


From: Ulrich Eckhardt
Subject: Re: Loading & Linking Error
Date: Tue, 18 Jan 2005 07:13:38 +0100
User-agent: KNode/0.8.1

Others gave most hints already, but I'll add some more..

Matthew Leung wrote:
> gcc -g -c Globals.cpp

Always (unless you really, really know what you are doing) add '-Wall' to
the commandline and make sure you understand the warnings you get.

> Globals.cpp:34:2: warning: no newline at end of file

You should be able to fix that easily.

> In file included from
> /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/include/g++-v3/backward/strstream:51,
>                  from Team.h:6,
>                  from TeamMaker.h:7,
>                  from TeamMaker.cpp:1:
> /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/include/g++-v3/backward/backward_warning.h:32:2:
> warning: #warning This file includes at least one deprecated or
> antiquated header. 

This isn't as easy to fix, but although deprecated, strstream is at least
still part of the standard, iostream.h of fstream.h aren't.

About makefiles:

'make' usually knows how to invoke the C++ compiler and already presets the
CXX variable. Further, people expect to be able to override this, which is
why you shouldn't set this in your makefile. Then, for compiling, use
  $(CXX) $(CXXFLAGS) -c filename.cpp
and for linking use
  $(CXX) $(CXXFLAGS) -o progname filename.o $(LDFLAGS)

Same as for CXX, don't force anything on the other variables, too. Rather
add to them if necessary.

Uli

-- 
http://gcc.gnu.org/faq.html
http://parashift.com/c++-faq-lite/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]