Yahoo Answers is shutting down on 4 May 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Compiling a wxWidgets program with gcc.?

I've installed wxWidgets installed on the desktop and I have a .cpp file already. The .cpp file is also on the desktop. I'm trying to run it using the command: g++ sample.cpp `wx-config --cxxflags --libs` -o test

However, I keep getting the error: g++: error: wx-config --cxflags --libs: No such file or directory

It seems to be that the .cpp isn't in the correct place. Does the .cpp have to be in a certain place?

1 Answer

Relevance
  • ?
    Lv 6
    6 years ago
    Favourite answer

    You've made a typo: `--cxflags' should be `--cxxflags'.

    Note: you should prefer $() instead of backquotes.

    Also, you should try and specify compilation flags and libraries first because libraries must be included before their symbols are required. "file not found" isn't a linker error, though.

    Try

    $ g++ $(wx-config --cxxflags --libs) sample.cpp -o test

    If it doesn't work (I'm concerned because I'm not able to reproduce the error), post the output of

    $ wx-config --cxxflags --libs

    And we'll see.

Still have questions? Get answers by asking now.