help-make
[Top][All Lists]
Advanced

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

Re: compiler flags


From: Paul D. Smith
Subject: Re: compiler flags
Date: Wed, 20 Jul 2005 16:14:19 -0400

%% "Fred J." <address@hidden> writes:

  fj> I think I have a wrong syntax for the flags, I need to
  fj> compile my c++ code for gdb debugging, that is include
  fj> the (-g) flage. is this correct?

  fj> proj1: $(OBJS)
  fj> <TAB> $(CXX) -og $@ $(OBJS)

This question isn't about make, actually: it's about your compiler.  The
flags that your compiler accepts are something you'll have to check the
docs for the compiler to discover.


However, in a traditional UNIX-type C compiler the -o flag takes the
output file as an argument.  So, what you have above:

    -og $@ $(OBJS)

is wrong: it means "link a bunch of files including $@ and $(OBJS), then
write the output to the file 'g'".

You need to write it like this:

    -g -o $@ $(OBJS)

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

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