Missing C++ support in Xcode9.2 for MacOS app? Topic is solved

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
supergordon
In need of some credit
In need of some credit
Posts: 1
Joined: Fri Aug 16, 2019 8:47 pm

Re: Missing C++ support in Xcode9.2 for MacOS app?

Post by supergordon » Fri Aug 16, 2019 9:28 pm

Im missing the option to create Cocoa apps with c++ too. For a console project c++ is available, but only obj-c and swift for cocoa apps.
I remember the XCode that came with Yosemite (OS X 10.10) still had support for c++. I've created a long time ago a tiny wxWidgets base project with only showing a wxFrame, but when you open it with newer XCode (im running now High Sierra with XCode 10) then the project loads fine and you can develope in c++, even it's not "supported" anymore. Anyway, heres the link to the base:

wxBase.rar

It contains a XCode project and a Visual Studio project (the base was for crossplattform development).
On Mac OSX to compile wxWidgets with clang, just go with terminal to the wxWidgets root directory, create a folder like "build-cocoa-clang". Change into that directory and execute

Code: Select all

../configure --with-osx --prefix /usr/local/ --disable-shared --enable-utf8 --enable-cxx11 --with-macosx-version-min=10.10 --with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk --disable-debug_flag
for a staticallly linkable libraries, and UTF8 support. Then go to the XCode project and adapt the C++ flags and the LIBS flags.
To get this flags, just execute in wxWidgets/build-cocoa-clang --> wx-config --cxxflags and wx-config --libs and copy it to the XCode project settings.
BTW: the project contains two apps to compile, one for osx and one for crosscompiling for windows with mingw. Remove it when not needed.

Thats basically it. Everything done (including compiling) within 5 minutes.

Post Reply