Author Topic: WxWidgets not compiling  (Read 2579 times)

Offline rartigas

  • Single posting newcomer
  • *
  • Posts: 4
WxWidgets not compiling
« on: November 24, 2023, 09:47:12 am »
Hi

I installed Codeblocks on a OSX computer with version 13.6 Ventura. Codeblocks version is 20.03 with Wxwidgets 3.2 installed. I did many tests in order to compile a simple Wxwidgets program. Just create a new project with WxSmith Frame Based. When building, the "build log" dialog shows the following:

g++ -Wall -g  -c /Users/artigas/Downloads/testCodeBlocks/test/test2/test2App.cpp -o obj/Debug/test2App.o
g++ -Wall -g  -c /Users/artigas/Downloads/testCodeBlocks/test/test2/test2Main.cpp -o obj/Debug/test2Main.o
g++  -o bin/Debug/test2 obj/Debug/test2App.o obj/Debug/test2Main.o 

which is missing the 'wx-config --cflags`and `wx-config --libs`already set by default in the Build Options  "other compiler options" and "linker settings".

If I set up the installation folder of the WxWidgets search directories, then it tries to compile, but there are more than 40 errors and the build message end with:

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

I tried with CodeBlocks 17, with WxWidgets compiled and installed from source, also with WxWidgets installed from Brew. Whatever I do is not able to compile any project with WxWidgets.

Any help will be wellcome
Roger
« Last Edit: November 24, 2023, 10:34:58 am by rartigas »

Online stahta01

  • Lives here!
  • ****
  • Posts: 7665
    • My Best Post
Re: WxWidgets not compiling
« Reply #1 on: November 24, 2023, 03:57:56 pm »
Not a Mac user; but, this is how I would try to troubleshoot the issue.

1. Run wx-config from command prompt
Edit: No idea if step 2 will work under Mac/OSX
2. Add `wx-config --cflags` to the CB Pre-build steps to see if it works.
    NOTE: Under Windows, I had to use "echo `sh.exe wx-config --cflags`" without double quotes
3. Build the wxWidgets minimal sample

Edit2: You need to reports results if you cannot understand the cause after the above 3 steps.

Edit3: See also https://forums.wxwidgets.org/viewtopic.php?f=19&t=50872
« Last Edit: November 25, 2023, 12:28:51 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline omlk

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: WxWidgets not compiling
« Reply #2 on: November 24, 2023, 06:45:36 pm »
I installed Codeblocks on a OSX computer with version 13.6 Ventura. Codeblocks version is 20.03 with Wxwidgets 3.2 installed. I did many tests in order to compile a simple Wxwidgets program. Just create a new project with WxSmith Frame Based.
Please provide a link from where we can download your zipped (my_project.zip) project to see what and how you have configured in code::blocks. Also, screenshots would be a good addition, on which you show and sign with a marker what and where you do not understand. People on the forum are not telepaths, and not everyone has macOS.
Ask the user @Xaviou for help, maybe he will tell you something.

Offline rartigas

  • Single posting newcomer
  • *
  • Posts: 4
Re: WxWidgets not compiling
« Reply #3 on: November 27, 2023, 09:16:03 am »
Hi

Thanks for your answer. I mostly found the problem. In Build Options and Linker settings, you have to specify `wx-config --cflags`and `wx-config --libs`respecrtively. The point is that Codeblocks is ignoring anything that is between the ` symbol.  I have to manually copy the output of wx-config from terminal into t Builder Options and then it works.