c++xcodelinkerwxwidgetswxformbuilder

How do I link files in an Xcode Build for C++


I'm pretty new to c++ and programming with Xcode and I am trying to run a program with multiple linked files and the wxWidgets GUI builder by pressing the run button in Xcode without having to switch back and forth between the Terminal and Xcode. Here is the compile command I use to compile the program in terminal: g++ -o a.out xxxx.cpp yyyy.cpp zzzz.cpp `wx-config --cxxflags --libs`.

I have tried adjusting the Build Settings for the project by adding `wx-config --cxxflags --libs` to the Other Linker Flags, but it still would not access the libraries. Is there a way to allow this all to compile inside of Xcode or should I just keep using the Terminal instead?


Solution

  • There are 2 ways to do that:

    1. If you built wxWidgets yourself from sources you can go to wxWidgets/samples/minimal where the sample Xcode project is. Open it inside the Xcode, remove minimal.cpp, add your source files and rebuild.

    2. If you didn't - follow instructions from here

    You will need to rebuild the program and then start the Bundle.

    BTW, on OSX you need to make the Application Bundle, especially since standalone applications are frown upon in Mac world.

    Read about them in Apple documentation.

    Thank you.