Author Topic: GCC 4.7 mixed with Objective-C problem  (Read 7549 times)

Offline labidus

  • Multiple posting newcomer
  • *
  • Posts: 10
GCC 4.7 mixed with Objective-C problem
« on: August 31, 2012, 03:02:36 am »
Recently I wanted to work with C++11 standard, I installed GCC 4.7 on my mac with MacPorts

All my C++ file work great but I only have 3 .mm file that was previously compiled without error using GCC 4.2 but with GCC 4.7
nothing work.

But I dont know why,here the actual compile line used by C::B:
gcc-mp-4.7  -g -fopenmp -std=c++11 -DDEBUG    -I/opt/local/include/libxml2 -I/usr/local/include  -c xxx.mm -o obj/Debug/xxx.mm.o

The filename is not xxx, anyway, I also try to use from the file property to use a different compiler without success, my option are ignored and never saved so
they always use the compiler option from the main project...

I get a bunch of error like this:
/System/Library/Frameworks/Foundation.framework/Headers/NSTask.h:75:24: error: expected unqualified-id before '^' token
/System/Library/Frameworks/Foundation.framework/Headers/NSTask.h:75:24: error: expected ')' before '^' token

Why GCC 4.7 give problem compared to 4.2?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5930
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: GCC 4.7 mixed with Objective-C problem
« Reply #1 on: August 31, 2012, 03:30:07 am »
From you post, I see only this:
Code
I also try to use from the file property to use a different compiler without success, my option are ignored and never saved so
they always use the compiler option from the main project...
is related to C::B.  :)

About the build error, I think you should ask in gcc help maillist.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline labidus

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: GCC 4.7 mixed with Objective-C problem
« Reply #2 on: August 31, 2012, 03:48:16 am »
From you post, I see only this:
Code
I also try to use from the file property to use a different compiler without success, my option are ignored and never saved so
they always use the compiler option from the main project...
is related to C::B.  :)

About the build error, I think you should ask in gcc help maillist.

Yes related to C::B :) because I cannot set custom compiler option to the .mm file, the change are never saved and they always use the project option instead

But i am pretty sure someone here got a similar issue and know what I can do to resolve this issue

Offline labidus

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: GCC 4.7 mixed with Objective-C problem
« Reply #3 on: August 31, 2012, 04:34:56 am »
I also try to change the command line from the main code block setting compiler option with different type of file
but none of the change I do is saved, I always end up with a white text box whenever I return back to the advanced option window from settings -> compiler debugger -> others settings -> advance

Offline labidus

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: GCC 4.7 mixed with Objective-C problem
« Reply #4 on: August 31, 2012, 05:23:44 am »
I finally was able to add one, you must enter only one extension, if you add m;mm it will not work, only mm, make the custom build option to work

Now it compile but i have other issue to resolve, at least its better then 2 hours ago :)