delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/12/02:11:14

From: ryot AT bigfoot DOT com (George Ryot)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Implicit make rules fail to link with std C++ library
Message-ID: <3788d992.10402823@news.clara.net>
References: <37897534 DOT 8132755 AT news DOT clara DOT net> <7m7bjl$ei9$1 AT news DOT luth DOT se>
X-Newsreader: Forte Agent 1.5/32.452
X-No-Archive: yes
MIME-Version: 1.0
Date: Sun, 11 Jul 1999 19:52:45 GMT
NNTP-Posting-Host: 195.8.91.62
X-Complaints-To: abuse AT clara DOT net
X-Trace: nnrp3.clara.net 931722765 195.8.91.62 (Sun, 11 Jul 1999 20:52:45 BST)
NNTP-Posting-Date: Sun, 11 Jul 1999 20:52:45 BST
Lines: 34
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

ams AT ludd DOT luth DOT se (Martin Str|mberg) wrote:

>CPPFLAGS is the preprocessor's flags. For C++ use CXXFLAGS.

Thanks, that makes more sense. Make's info pages show how standard
macros are used to make up a compile/link command line, but I can't
find a summary of each macro and its conventional use.

What I am trying to acheive is a makefile that has a reasonable chance
of working on different platforms, is it safe to assume that CXXFLAGS
will work or should I set CFLAGS as normal then do CXXFLAGS=$(CFLAGS)?

>If you still have a problem, use "make -pn" and analyse its output.

I did that and now it is clearer what is required to force linking
with the standard c++ library, I have a choice:

LDLIBS = -lstdcxx

This works with DJGPP but on other platforms may fail because the
library is named differently.

CC = gxx

This seems cleaner. Although it is still platform specific, it's not
unreasonable to have to set the compiler name and probably not beyond
most users to figure this one out. If the target is not explicitly
made dependent upon object files(s) then 'CXX = gxx' is also required.

Thanks for the help, I still don't understand why the default
behaviour of make doesn't cater for building c++ projects, but at
least I now have a working makefile.
-- 
george

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019