Re: A makefile with a mix of gcc and g++

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

 



On 12 April 2011 11:57, Mahmood Naderan wrote:
> Hi,
> I have a makefile that compiles source files with gcc. However I want to exclude
> one file and compile it with g++ (since I want to use STL in a pure ANSI C
> application).

If your application is *pure* C then you can't use C++, so I'm not
sure what you mean.

> The question is how can I do that in such a way that make file
> automatically compile this file with g++ and others with gcc.

This is a question about writing makefiles, which is not a question
about using gcc, however ...

The answer entirely depends how your makefile is written.  The
conventional way would be for C files to be compiled with $(CC) and
C++ files to be compiled with $(CXX) so you would simply ensure that
your source files have the correct file extensions so make correctly
identifies their type and uses the correct rule for compiling that
file type.

So just use the conventional file extension for C++, one of .cc, .C, .cpp etc.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux