Search code examples
xcodemacosxcode7wxwidgets

How do I create projects on Xcode 7 using wxWidgets?


My specifications are up to date (OS X El Capitan, 10.11). Here are details on what I've tried so far.

I've followed the (Terminal) installation steps included in the wxWidgets download:

mkdir build-cocoa-debug
cd build-cocoa-debug
../configure --enable-debug
make
cd samples; make;cd ..
cd demos;   make;cd ..

Then, I followed the wxWidgets wiki guide for creating Xcode projects.

Of course, there were plenty of compilation errors. After taking care of an incorrectly typed include, there were still issues. For the most part, they were undeclared identifiers and incomplete types, but my attention went to one in particular:

"No Target! You should use wx-config program for compilation flags!"

After researching, I believe I need to use wx-config to find what flags to input into the "Other Linker Flags" option in Xcode. However, I can't seem to utilize wx-config in Terminal.

I'm not sure if I'm dealing with the core issue. If I am, how do I use wx-config? And if I'm not, please steer me in the right direction.

Thank you.

*** EDIT: ***

I've used wx-config to find which flags I needed to input into "Other Linker Flags" and "Preprocessor Macros" in Xcode. This significantly reduced the amount of errors and warnings that I was facing.

Unfortunately, these new errors are esoteric to me:

Error/Warning Log

How do I remove these errors so I can run this project?


Solution

  • I'm finally able to compile and run wxWidgets programs using Xcode 7. I've found and followed this awesome guide (of which step 3 seems to now be irrelevant).

    In case the link breaks, here is a summary of the steps that helped me:

    * * * * * *

    Open Terminal and install Homebrew by inputting:

    ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
    

    Then, input:

    brew install wxmac
    

    Open Xcode and create a Command Line Tool C++ project.

    Back in Terminal, input:

    wx-config --libs
    

    Once inputted, copy everything outputted by the Terminal and place it into Other Linker Flags (found in Build Settings of your Xcode project).

    At Terminal, input:

    wx-config -–cxxflags
    

    Again, copy everything outputted except this time place it into Other C++ Flags (do not erase what is currently in that section).

    Then, of course don't forget to include wx/wx.h and don't forget to have at least an empty main function if you want it to run.

    * * * * * *

    I'm not at a place where I can create Cocoa projects/products, but that's totally fine. I simply wanted a canvas to familiarize myself with the wxWidgets library.

    I hope this post will be helpful to others.