Re: Using different compilers for C vs C++?
Re: Using different compilers for C vs C++?
- Subject: Re: Using different compilers for C vs C++?
- From: Jean-Daniel Dupas <email@hidden>
- Date: Thu, 18 Feb 2010 19:15:31 +0100
Le 18 févr. 2010 à 18:32, Sean McBride a écrit :
> On 2/13/10 11:26 AM, Jean-Daniel Dupas said:
>
>>> Thanks for this pointer! I've also just read the "Build Rules" section
>>> of the Xcode docs. Alas, I still can't get this to work.
>>>
>>> I've opened the target inspector and created a rule (which is at the top
>>> of the list)
>>> Process: C++ files
>>> using: Rez
>>>
>>> I expect catastrophic failure. Everything still builds. I've tried
>>> other choices for 'using' and it seems to have no effect. I have no
>>> other custom rules anywhere (as best as I can tell).
>>>
>>> Any ideas?
>>
>> Yes, try with GCC and LLVM-GCC instead of trying with Rez.
>> I have redefined C rule tu use GCC-4.2 and add a C++ rule to use llvm-
>> gcc and it works (if you want to know if it works, check the transcript )
>> Xcode built-in compiler have a list of supported file type, so it will
>> probably refuse to use Rez fro c++ and fallback to the default setting.
>
> The test with Rez was a last resort, my initial tests were with C & C++
> rules. So I've just tried this:
>
> - create new project from Cocoa Application stationary
> - add a .c file
> - add a .cp file
> - put the following in both:
>
> #if __GNUC_MINOR__ == 0
> #warning gcc 4.0
> #elif __GNUC_MINOR__ == 2
> #warning gcc 4.2
> #endif
>
> First I changed between gcc 4.0 and 4.2 by changing GCC_VERSION, this
> worked as expected.
>
> Then I:
> - went to the target setting > Rules
> - I changed the C rule, it said I need to make a duplicate, fine
> - it added a new item to the top of the list, fine
> - I set "Process" to "C++ source files" and "using" to "GCC 4.0"
> - close the window
> - clean all
> - quit & relaunch Xcode
> - build
> - examine compiler warnings -> it's still using gcc 4.2
>
> I hope I'm just missing something obvious here....
Damned, your right. It's broken. I tried with gcc-4.2 and llvm-gcc-4.2 the last time (as the project I used to test does not compile with gcc-4.0) and this combination works.
But I don't found a way to tell Xcode to use gcc-4.0 to compile C++ code.
You're are doom to create a new static library target with your cpp file with compiler version set to GCC-4.0 in the build setting.
-- Jean-Daniel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden