*.cpp in Phab makefile

Hello,

I have a project with several C++ source modules and use a makefile from PhAB.

It seems to me that cpp files are not correctly recognized from the make utility.

When I add an entry to indSfiles, it is only compiled if the suffix is .C or cc, but .cpp seems to
be ignored.

I read in the documentation that cpp should be supported.

I remember that I once read somewhere about a bug concerning cpp file handling but can’t remember
where.

Who can tell me about a fix ?


I use QNX 4.25, Photon 1.14 and Watcom 10.6


Gerd Hedtke

Gerd Hedtke <Gerd.Hedtke@t-online.de> wrote:

I have a project with several C++ source modules and use a makefile from PhAB.

It seems to me that cpp files are not correctly recognized from the make utility.

That’s correct. The make shipped with QNX4, or at least some versions
of it, doesn’t have a default rule for “.cpp”.

When I add an entry to indSfiles, it is only compiled if the suffix is .C or cc, but .cpp seems to
be ignored.

I read in the documentation that cpp should be supported.

It is recognized by PhAB as a C++ extension, but PhAB relies on you to
make sure that the extension you pick for your files is supported by
your building environment. PhAB itself uses “.cc” for its abmain module
– as you have noticed, it’s a safer choice…

I remember that I once read somewhere about a bug concerning cpp file handling but can’t remember
where.

Who can tell me about a fix ?

Adding a rule similar to this to your Makefile has worked for me:

%.o: %.cpp
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<

Even better, you could take copy of the default rule for “.cc” – run
“make -p” and search the output for “%.o: %.cc”.

\

Wojtek Lerch (wojtek@qnx.com) QNX Software Systems Ltd.

Wojtek Lerch <wojtek@qnx.com> wrote:

Adding a rule similar to this to your Makefile has worked for me:

I meant my Makefile, of course. :slight_smile:


Wojtek Lerch (wojtek@qnx.com) QNX Software Systems Ltd.