Terminal gets a different version of wxwidgets than IDE's compiler

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
coyoteazul
In need of some credit
In need of some credit
Posts: 1
Joined: Sun Nov 03, 2019 11:55 pm

Terminal gets a different version of wxwidgets than IDE's compiler

Post by coyoteazul » Mon Nov 04, 2019 1:51 am

Hi. I just tried switching from 3.0 to 3.1, but my IDEs seem to not want to cooperate with that change.

When i run wx-config on terminal, or run a program compiled on terminal, I get 3.1.3. But a program compiled on an IDE returns 3.0.4

Code: Select all

#include <iostream>
#include <wx/versioninfo.h>
#include <string>
#include <wx/string.h>

int main () {
    std::cout << wxString(wxVERSION_STRING).ToStdString() << std::endl;
    return 0;
}
compiling on terminal

Code: Select all

g++ main.cpp `wx-config --libs --cxxflags` -o main 
result

Code: Select all

wxWidgets 3.1.3

compiling on IDE (example comes from codelite, but the same happens on codeblocks)
C++ compiler options

Code: Select all

$(shell wx-config --libs --cxxflags)
Build log

Code: Select all

/bin/sh -c '/usr/bin/make -j4 -e -f  "pru.mk"  MakeIntermediateDirs && /usr/bin/make -j4 -e -f  "pru.mk"  all'
----------Building project:[ pru - Debug ]----------
/usr/bin/g++  -c  "/home/hernan/Dropbox/programacion/prueba/pru/main.cpp" -I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -L/usr/lib/x86_64-linux-gnu -pthread   -lwx_gtk2u_xrc-3.0 -lwx_gtk2u_html-3.0 -lwx_gtk2u_qa-3.0 -lwx_gtk2u_adv-3.0 -lwx_gtk2u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0   -o ./Debug/main.cpp.o -I. -I.
/usr/bin/g++ -o ./Debug/pru @"pru.txt" -L.   -L/usr/lib/x86_64-linux-gnu -pthread   -lwx_gtk2u_xrc-3.0 -lwx_gtk2u_html-3.0 -lwx_gtk2u_qa-3.0 -lwx_gtk2u_adv-3.0 -lwx_gtk2u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0
====0 errors, 0 warnings====
result

Code: Select all

wxWidgets 3.0.4
As you can see it seems that on the IDE wx-config points to a different folder than on terminal. Any clue of why this could be happening? and maybe how to solve it?

stahta01
Super wx Problem Solver
Super wx Problem Solver
Posts: 373
Joined: Fri Nov 03, 2006 2:00 pm

Re: Terminal gets a different version of wxwidgets than IDE's compiler

Post by stahta01 » Mon Nov 04, 2019 6:57 am

Look inside the makefile

DavidHart
Site Admin
Site Admin
Posts: 3998
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: Terminal gets a different version of wxwidgets than IDE's compiler

Post by DavidHart » Mon Nov 04, 2019 10:32 am

Hi,

(I presume your terminal is 'clean', and not one where you have previously prepended to its PATH e.g. PATH=/path/to/wx3.1.3/:$PATH. Similarly that you don't have such a line in your ~/.bashrc or similar.)

CodeLite lets you set a particular wx version in several ways:
1) You can point directly at one in your Compiler and your Linker settings. That's not happening here: $(shell wx-config --libs --cxxflags) will get the standard one. (BTW, you don't want --libs in the Compiler settings; they go in the Linker ones.)
2) In your Project Settings:Environment you can set a path to a particular wx build.
3) In the main menu, Settings > Environment Variables, again you can set particular paths. One of mine is
PATH=/usr/lib/ccache/:$PATH
but I could have selected a wx build too.
4) In Project Settings:Customise you can tick 'Enable custom build', after which all mistakes are your fault ;) .

If none of that helps, I suggest you create a new project from one of the templates and see which wx that picks up. If that is still wx3.0.4, then close CodeLite, temporarily rename your ~/.codelite, and restart CodeLite. Everything will then be default.

Regards,

David

Post Reply