Mark, The Makefile template that you sent me looks like it was based on a Makefile template for C programs, NOT C++ programs.
For C++, you need to set CXX to the compiler and use CXXFLAGS for the C++ compiler flags. Use +=. Do not use := since MacPorts will likely want to add its own flags. LDFLAGS should be also be used to set any linker flags. Again use += e,g, LDFLAGS += Here is the format. $(MAIN): $(OBJS) $(CXX) $(CXXFLAGS) $(LDFLAGS) $(INCLUDES) -o $(MAIN) $(OBJS) $(LFLAGS) $(FWORKDIRS) $(LIBS) $(FWORKS) where LFLAGS += library directories. LIBS += library flags e.g. -lm for math library FWORKDIRS += Framework directories etc Rob ________________________________ From: macports-dev <[email protected]> on behalf of Mark Brethen <[email protected]> Sent: August 8, 2022 12:22 PM To: Joshua Root <[email protected]> Cc: MacPorts Developers <[email protected]> Subject: Re: include files for cgxCADTools The makefile only sets cc, not c++. If I remove -lstc++ from LIBS, then I need to add it to the portfile using LDFLAGS. The Makefile uses LFLAGS, which I don’t want to override. Should I add LDFLAGS to MAIN, like so: $(MAIN): $(OBJS) $(CC) $(CFLAGS) $(INCLUDES) -o $(MAIN) $(OBJS) $(LFLAGS) $(LIBS) $(LDFLAGS) Mark Brethen [email protected] > On Aug 8, 2022, at 11:10 AM, Joshua Root <[email protected]> wrote: > > That's a completely different thing. The language standard is selected by > -std, the stdlib implementation is selected by -stdlib, and linking to a > stdlib directly (as -lstdc++ does) is usually a bug since the C++ compiler > will implicitly add the appropriate stdlib when linking. > > - Josh > > On 2022-8-9 01:16 , Mark Brethen wrote: >> There is also -lstdc++, I thought those should be set in the Portfile. >> Doesn’t macports-clang have its own standard? >> Mark Brethen >> [email protected] <mailto:[email protected]> >>> On Aug 7, 2022, at 7:22 PM, Ryan Schmidt <[email protected] >>> <mailto:[email protected]>> wrote: >>> >>> In fact, the Makefile already had -std=c++11, but your patchfile removed >>> it. So don't remove it. >
