Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] Mixed C/C++ sources under 3.0.2 and Environment variables

Hi Matthias,

>Should this also work under 3.0.2?

I can't think of why not.

>I've set the natureFilter for my compiler to 'both'

This just causes the compiler to be used by both "C" and "C++" projects.
I assume that you only have a single compiler in your tool-chain
definition.

>added an inputType for the compiler that looks at .c and .cpp files.

Do you now have 2 InputTypes?  If so, that is the problem.  One
input-type is considered the primary input.  The compiler will be called
for each project resource that is of that type.  The other input-type is
considered a secondary input, and all files of that type will be added
to every compilation.

Maybe, what you were trying to do was to indicate that the tool should
process 2 content-types - i.e., the C Source content-type and the C++
Source content-type.  Unfortunately, I'm not sure there is a
straight-forward way to do that currently.  An input type can take a
list of hard-coded extensions or a single content-type.  I probably
should have made that a list also, but it is not.  If this is what you
were trying to do, you could enter a bugzilla enhancement request.  For
now, you may have to use the extension list or create a new content-type
that contains both C and C++ sources.  Another option is to use the C++
content-type and add the .c extension to it programmatically on a
per-project basis.  The MBS does this when you convert a MBS 2.1 C++
project that contains a .c file to 3.0.

> I also have a question about configurationEnvironmentSuppliers. We
have
several versions of GCC installed but only want to use a specific one
when building via Eclipse. So I wrote an Environment Supplier which
prepends the PATH to use the appropriate gcc. This works when building
projects but the projects Includes folder has data from a different GCC
also installed on the system. I'd prefer to not update the actual system
PATH to always point to the special GCC. Any suggestions on how I could
guarantee that Includes folder data is pulled from the special GCC?

I'm not sure there is any way to do that currently.  The problem is that
the CDT code that calculates those includes is unaware the MBS mechanism
for setting the environment.  This is the sort of problem that we want
to fix using the "new project model" - in particular, having the
information provided by a tool-chain integration be used CDT-wide
instead of only in the MBS.

I hope this helps,
Leo


-----Original Message-----
From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
On Behalf Of Matthias Halfmann
Sent: Tuesday, March 07, 2006 5:38 PM
To: cdt-dev@xxxxxxxxxxx
Subject: [cdt-dev] Mixed C/C++ sources under 3.0.2 and Environment
variables

Hi all,

I'm having some trouble getting a CDT plug-in to work as I would like it
to. I'm running Eclipse 3.1.2 and CDT 3.0.2.

>From reading the thread 'Mixed C/C++ in MBS' it should be possible to
have a single compiler for .c and .cpp source files. Should this also
work under 3.0.2?

I've set the natureFilter for my compiler to 'both' and added an
inputType for the compiler that looks at .c and .cpp files. This does
allow a MBS project to attempt to build the C and C++ sources but the
compiler command line is invalid. The generated command line always
includes '../foo.cpp' as the last argument. So...

gcc -O0 -Wall -c -otest.o ../test.c ../foo.cpp
gcc -O0 -Wall -c -ofoo.o ../foo.cpp ../foo.cpp

Can anyone recommend the 'right' way of mixing C/C++ sources under CDT
3.0.2?

I also have a question about configurationEnvironmentSuppliers. We have
several versions of GCC installed but only want to use a specific one
when building via Eclipse. So I wrote an Environment Supplier which
prepends the PATH to use the appropriate gcc. This works when building
projects but the projects Includes folder has data from a different GCC
also installed on the system. I'd prefer to not update the actual system
PATH to always point to the special GCC. Any suggestions on how I could
guarantee that Includes folder data is pulled from the special GCC?

Thank you very much for any help or insights!
Matthias
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev


Back to the top