From: ams AT ludd DOT luth DOT se (Martin Str|mberg) Newsgroups: comp.os.msdos.djgpp Subject: Re: Implicit make rules fail to link with std C++ library Date: 11 Jul 1999 20:06:49 GMT Organization: University of Lulea, Sweden Lines: 48 Message-ID: <7matgp$opn$1@news.luth.se> References: <37897534 DOT 8132755 AT news DOT clara DOT net> <7m7bjl$ei9$1 AT news DOT luth DOT se> <3788d992 DOT 10402823 AT news DOT clara DOT net> NNTP-Posting-Host: queeg.ludd.luth.se X-Newsreader: TIN [UNIX 1.3 950824BETA PL0] To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com George Ryot (ryot AT bigfoot DOT com) wrote: : 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 are using GNU make, then I think it's safe. My make on my Linux box has the same rule as DJGPP port for C++ files. : >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. Yes, then we are two. Because if you do you use CXX (which should be g++ or gpp or gxx, the C++ compiler) then it should append the C++ runtime library. Personaly, I wouldn't do "CC=gxx" because you just remove the symptom, not the cause of your problem. Right, MartinS