Search code examples
wxwidgetsxcode4.5osx-mountain-lion

wxWidgets 2.9.4 + Xcode 4.5.2 - Can't make it work


I'm having troubles trying to use wxWidgets 2.9.4 and Xcode 4.5.2, I get all sort of errors in the way. First of all, I think I installed wxWidgets correctly, because every sample and demo run just fine. The problem is when I try to create an Xcode project.

  1. When I follow the wxWidgets tutorial changing the build settings as follows:

    • Paste the --cppflags in "Other C++ Flags"
    • Paste the --libs in "Other Linker Flags" (REMOVING THE -L)
    • Change the compiler to GCC I get:

    • ld: library not found for -lwxregexu-2.9

      clang: error: linker command failed with exit code 1 (use -v to see invocation)

  2. When I follow the http://zebratale.tumblr.com tutorial (seems more detailed to me) I get:

    ld: library not found for -lwx_osx_cocoau_xrc-2.9

    clang: error: linker command failed with exit cod 1 (use -v to see invocation)

I'm completely lost and I'd appreciate any help

------------UPDATE------------------------

I just found out that it's possible to compile it using the terminal command:

g++ -o main main.cpp './../../build-cocoa-debug/wx-config --debug --cxxflags --libs'

So I guess the problem is the compiler Xcode is using. But when I change it to LLMV GCC 4.2, I get the same error (YES, as if it was still using clang) To change the compiler I went to build settings->build options->compiler for c/c++/objective-c and changed it.

---------UPDATE2-----------------

Even now that I changed the compiler on Xcode the error is:

ld: library not found for -lwx_osx_cocoau_xrc-2.9

collect2: ld returned 1 exit status

Command /Applications/Xcode.app/Contents/Developer/usr/bin/llvm-g++-4.2 failed with exit code 1


Solution

  • First, use --cxxflags (C++ compiler flags), not --cppflags (C preprocessor flags).

    Second, why do you remove -L? Of course the linker can't find the libraries if you remove the option telling it where they are.