HICococaView does not compile with GCC 4.2

We have a large Carbon-based application (PowerPlant), which we are finally looking for for porting to Cocoa. We will do this gradually, and the first step is to try to get a Cocoa view in the Carbon window.

The problem is that when I use any of the functions from HICocoaView.h, the application will not compile unless I switch the compiler from GCC 4.2 to GCC 4.0.

Using any compiler other than GCC 4.0, I get an error in Xcode that functions are not available, for example. "HICocoaViewCreate is not available."

I can’t understand why this will not work, do we need to switch to the old compiler or are there any settings that we can change in order to compile them?

Any help or pointers to helpful documentation on porting Carbon to Cocoa is welcome. I read the old Carbon Cocoa integration guide, but it doesn't mention it.

Edit: As requested by the build result for the gcc command line here: -

/Developer/usr/bin/gcc-4.2 -x objective-c ++ -arch i386-fmessage-length = 0 -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wmissing-prototypes -Wreturn-type -Wunused-variable -Wunused-value -D__IMPRO_DEBUG_BUILD__ -isysroot / Developer / SDKs / MacOSX10.5 .sdk -mfix-and-continue -mmacosx-version-min = 10.5 -gdwarf-2 "-I / Users / matte / Code / MattsFeatureBranch / Modules / User Notes / Mac /../../../ (intermediate products) / Debug / User Notes.build/Debug/Module Bundle.build/User Notes.hmap "-Wparentheses -Wno-conversion -Wno-sign-compare -Wno-multichar -Wno-deprecated-declarations" -F / Users / matt / Code / MattsFeatureBranch / Modules / User Notes /Mac/../../../Build Products / Mac / Debug / Plugins "" -F ../../../ Build Products / Mac / Debug " "-F ../../../ Third party / Mac / NVidia" "-I / Users / matte / Code / MattsFeatureBranch / Modules / User Notes /Mac/../ ../../Build Products / Mac / Debug / Plugins / include "-I ../ X-Platform -I ../../../ Common / Mac -I ../../../ Common / X-Platform -I ../../../ DLL / ArcadiaCore / Mac -I ../../../ DLL / ArcadiaCore / X-Platform "-I ../../../ / Mac / Powerplant "-I / Developer / SDK / MacOSX10.5.sdk / Developer / Headers / FlatCarbon" -I ../../../ Third-party / X-Platform / boost_1_38_0 "-I ../ .. /../DLLs/ArcadiaImaging/Mac -I ../../../ DLL / ArcadiaImaging / X-Platform -I ../../../ DLL / ArcadiaDatabase / Mac -I ../ .. /../DLLs/ArcadiaDatabase/X-Platform -I ../../../ DLLs / ArcadiaUI / Mac -I ../../../ DLL / ArcadiaUI / X -Platform "-I .. /../../ Side / Mac / Powerplant Extras "-I ../../../ DLLs / ArcadiaDevices / Mac -I ../../../ DLL / ArcadiaDevices / X-Platform -I ../../../DLL/Arcadia3D/Mac -I ../../../ DLLs / Arcadia3D / X-Platform "-I / Users / matte / Code / MattsFeatureBranch / Modules / User Notes / Mac /../../../ (intermediate products) / Debug / User Notes.build/Debug/Module Bundle.build/DerivedSources/i386 " "-I / Users / matte / Code / MattsFeatureBranch / Modules / User Notes / Mac /../../../ (intermediate products) / Debug / User Notes.build/Debug/Module Bundle.build/DerivedSources" - fpermissive -fasm-blocks -include "/ Users / matte / Code / MattsFeatureBranch / Modules / User Notes / Mac /../../../ (intermediates) /Debug/SharedPrecompiledHeaders/XPrefix-acshmfbgvfwrdqbyayvgnckkypgr/XPrefix. c "/ Users / matt / Code / MattsFeatureBranch / Modules / User notes /Mac/MUserNotesView.cpp" -o "/ Users / matte / Code / MattsFeatureBranch / Modules / User Notes / Mac /../../../ (between nye products) / Debug / User Notes.build/Debug/Module Bundle.build / Objects-normal / i386 / MUserNotesView.o "

+3
1

HICocoaView.h 10.5, 10.6 SDK:

#if !__LP64__
extern OSStatus
HICocoaViewCreate(
  NSView *     inNSView,        /* can be NULL */
  OptionBits   inOptions,
  HIViewRef *  outHIView)                                                       AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
…
#endif  /* !__LP64__ */

, HICocoaViewCreate() 64- (LP64) , , i386 ( PowerPC).

GCC 4.0 i386, 64- . , GCC 4.2 x86_64 64- :

$ gcc-4.0 a.c; lipo -info a.out
Non-fat file: a.out is architecture: i386

$ gcc-4.2 a.c; lipo -info a.out
Non-fat file: a.out is architecture: x86_64

HICocoaViewCreate(), GCC 4.2, ( ) 32- / , -arch i386. ,

$ gcc-4.2 a.c -arch i386; lipo -info a.out
Non-fat file: a.out is architecture: i386

, Carbon 64- , 64- , HIToolbox .

Carbon Cocoa, API Objective-C . , .

+3

Source: https://habr.com/ru/post/1786874/


All Articles