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

Hi Doug and all,

 

Let’s see if we can turn this into specific proposal.  I’m not an expert in the pitfalls of mixed C/C++, so here are some questions:

 

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

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

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.

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?

 

Thanks,

Leo

 


From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Pete MacLiesh
Sent: Sunday, February 26, 2006 10:37 PM
To: 'CDT General developers list.'
Subject: RE: [cdt-dev] Mixed C/C++ in MBS

 

 

What's a project that has only c sources, but some there's some C++ in libraries? Would the c developer even know? You need to know because the linker will not necessarily grab the right libstdc++, and static constructors may not get generated? Does that mean all projects are c++, and c is just degenerate c++? As long as any linker that thinks its linking c++ will omit unreferenced junk.

 

 

Ciao,

PMac
 

 

 


From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Doug Schaefer
Sent: Sunday, February 26, 2006 6:55 PM
To: CDT General developers list.
Subject: RE: [cdt-dev] Mixed C/C++ in MBS

I’m not sure I agree with that argument. Mixed C and C++ projects are common in the embedded world since people are still slowly migrating to C++ as memory requirements ease and want to use some legacy C files in their new C++ projects. These people would expect there to be two tools listed since there is a culture that these are two very different languages. I don’t think the confusion would be an issue in this market.

 

We are getting a lot of bug reports on this, more than I’d expect from the potential confusion on having both tools listed in the properties. This confusion could be minimized by having the C++ tool listed first. I vote to turn the C compiler on for C++ projects. Of course, you have the right to veto.

 

Doug Schaefer, QNX Software Systems

Eclipse CDT Project Lead, http://cdtdoug.blogspot.com

 


From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Treggiari, Leo
Sent: Sunday, February 26, 2006 11:04 AM
To: CDT General developers list.
Subject: RE: [cdt-dev] Mixed C/C++ in MBS

 

I think the biggest problem with this approach is that most projects will be using only C++ sources or only C sources, but the user will see 2 compilers on the property page - or maybe they’ll only notice one – hopefully, the correct one…  We could only display a tool if the project contained (or generated) a corresponding resource.  It’s the “generated” case that’s a bit of work.  Currently, I think we only figure that out during makefile generation.

 

Regards,

Leo

 


From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Sennikovsky, Mikhail
Sent: Sunday, February 26, 2006 3:21 AM
To: CDT General developers list.
Subject: RE: [cdt-dev] Mixed C/C++ in MBS

 

Hi Doug,

 

You are right, In case you specify “both” instead of “cnature” for the C compiler tool, both the C and C++ sources will be included in the build.

The only thing that might seem confusing in this case is that the gnu project properties UI will now contain settings for two compilers C and C++ separately and there is no way for the user to change some option for both compilers simultaneously. But in case your tool-chain defines one compiler tool for both C and C++ sources, there will be no such a problem.

 

Thanks,

Mikhail

 


From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Doug Schaefer
Sent: Saturday, February 25, 2006 9:53 PM
To: CDT General developers list.
Subject: RE: [cdt-dev] Mixed C/C++ in MBS

 

I’ve got to be missing something. I just change the nature for the definition of the gnu C compiler to be ‘both’ instead of ‘cnature’ and my C files in C++ projects now get included in the build.

 

It can’t be this easy is it?

 

Doug Schaefer, QNX Software Systems

Eclipse CDT Project Lead, http://cdtdoug.blogspot.com

 


From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Treggiari, Leo
Sent: Friday, February 24, 2006 12:13 PM
To: CDT General developers list.
Subject: RE: [cdt-dev] Mixed C/C++ in MBS

 

Hi Doug,

 

Here are the problems that I remember right now:

 

1.  The MBS project creation UI still makes the user select a C project vs. a C++ project.  The Tools in the tool-chain of a project get “filtered” based upon the project nature (C vs. C++).  So, even though a tool-chain may contain both C and C++ compilers, only one will be used for the project.  There may be other MBS logic that distinguishes between C and C++ natures, but I can’t remember any off hand.

2.  MBS now uses content types, and I don’t know that the “case sensitivity” content type issues have been resolved.  See bugzillas 103530, 115388, and 105022.

 

The current situation is that a user must create a C or C++ project.  The user can make a project-specific addition to a content type – for example to be able to process .c files in a C++ project.  However, those .c files will be compiled by the C++ compiler.

 

Our intention is to address these problems as part of the new “Project Model”, but we have no concrete plans there yet.

 

Regards,

Leo

 


From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Doug Schaefer
Sent: Friday, February 24, 2006 11:54 AM
To: CDT General developers list.
Subject: [cdt-dev] Mixed C/C++ in MBS

 

Hey guys,

 

I’m trying to figure out where we are with MBS as I start to use it for our internal QNX toolchain. There was an issue with having C files in C++ projects. Can someone update me on where we are with that and whether you need my help addressing it?

 

Thanks,

Doug Schaefer, QNX Software Systems

Eclipse CDT Project Lead, http://cdtdoug.blogspot.com

 

 


Back to the top