Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] Mixed C/C++ in MBS

I have no objection to making the change, and I will make it if no one speaks up within a day or so.

I do have 2 more comments:

1.  There will be no automatic propagation of properties between the C and C++ tools.  For example, if you need to set the same defines on both, you will need to do that separately for each tool.

2.  In the future, we're looking to provide only a "compiled-language" project type, and not specific C, C++ or Fortran projects.  Does anyone have any ideas on how we will solve the linker problem then?  For now, we can still select the linker based upon whether the user creates a C or C++ project.

Regards,
Leo

-----Original Message-----
From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Doug Schaefer
Sent: Monday, February 27, 2006 10:41 AM
To: CDT General developers list.
Subject: RE: [cdt-dev] Mixed C/C++ in MBS

1.  Do you always want to compile source with C extensions with the C
compiler and sources with C++ extensions with the C++ compiler?

[D] Yes. g++ calls the gcc C compiler when it sees a C file anyway.

2.  What about the linker to use?  With mixed C/C++ is it always the C++
linker?

[D] Yes. For now the linker needs to stay as it is. Some have argued that we
should not be using the nature for this but rather a build setting, but I'm
not sure if that makes things better or just different...

3.  Doug suggests that we make the C compiler "active" in a C++ project - I
assume you mean the reference Gnu tool-chains?  There is nothing stopping
anyone from doing that in their own tool-chain.

[D] Of course. The setting I am talking about is on the gnu C compiler
definition. I am not proposing that we get rid of nature handling for tools.

4.  What about Pete's scenario below?  If the user has only C sources and
selects a C project, but is using one or more C++ libraries, will the C
linker work?  If not, what can we do about this case?

[D] The C linker should work in this case. I assume that the C++ code is
wrapped with C code to provide an interface for it to be called by other C
code. Actually you can use the C linker to link C++ code as long as you have
the correct libraries on the link line (libstdc++ for example). For that
matter, linking is inherently language independent, especially if you use ld
as the linker, which is what gcc and g++ call anyway.

[D] To summarize, my proposal is to change the nature of the gnu C compiler
to be both and to change the order of the tools listed in the gnu configs to
list the C++ compiler first. That's all.

Thanks,
Doug
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev


Back to the top