User forums > Using Code::Blocks
wx project compile/link - behind the scenes activity
sorinev:
I rolled my own makefile for a wx project that I have as a part of my efforts to become familiar with the make system and command line compiling and so forth. I'm seeing some differences between the options being posted to the log (c::b) / console (my make) and in the resulting GUI of the app itself. I don't see any significant differences to my untrained eye in the command line being used (in the case of my make) and the options in codeblocks for the project. So I'm wondering what goes on with wx projects behind the scenes as far as command line goes that isn't seen in the project or ide options.
This is on Kubuntu 14.04, so global variables in C::B don't come into play like they would on Windows.
Here is my make file.
--- Code: ---CC := g++
EXE := wxDFedit
EXE_DIR := bin/
EXE_PATH := $(EXE_DIR)$(EXE)
OBJ_LIST = DFTab.o GeneralsTab.o wxDFeditApp.o wxDFeditMain.o
OBJ_DIR := obj/
OBJS = $(foreach obj,$(OBJ_LIST), $(OBJ_DIR)$(obj))
LIBS = $(shell wx-config --libs base, core, aui)
CXXFLAGS = -Wall -O2 -s $(shell wx-config --cflags)
build: $(EXE_PATH)
$(EXE_PATH): $(OBJS)
$(CC) -s -o $@ $^ $(LIBS)
$(OBJ_DIR)%.o: interface/%.cpp
$(CC) $(CXXFLAGS) -c $< -o $@
clean:
-rm -f $(OBJS) $(EXE_PATH)
rebuild: clean build
--- End code ---
which results in the following:
--- Code: ---g++ -Wall -O2 -s -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 -c interface/DFTab.cpp -o obj/DFTab.o
g++ -Wall -O2 -s -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 -c interface/GeneralsTab.cpp -o obj/GeneralsTab.o
g++ -Wall -O2 -s -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 -c interface/wxDFeditApp.cpp -o obj/wxDFeditApp.o
g++ -Wall -O2 -s -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 -c interface/wxDFeditMain.cpp -o obj/wxDFeditMain.o
g++ -s -o bin/wxDFedit obj/DFTab.o obj/GeneralsTab.o obj/wxDFeditApp.o obj/wxDFeditMain.o -L/usr/lib/x86_64-linux-gnu -pthread -lwx_baseu-3.0 -lwx_gtk2u_core-3.0 -lwx_gtk2u_aui-3.0
--- End code ---
The options relevant to wxWidgets in Code::Blocks for the project are:
--- Code: ---`wx-config --cflags`
--- End code ---
--- Code: ---`wx-config --libs`
--- End code ---
aside from general compiler options you'll see in the output below:
--- Code: ---++ -Wall -O2 -I/opt/wx/3.0_unicode_monolithic_shared/lib/wx/include/gtk3-unicode-3.0 -I/opt/wx/3.0_unicode_monolithic_shared/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -O2 -Wextra -Wall -std=c++11 -c ~/Code/wxWidgets/dfedit-wx/interface/DFTab.cpp -o obj/Release/interface/DFTab.o
g++ -Wall -O2 -I/opt/wx/3.0_unicode_monolithic_shared/lib/wx/include/gtk3-unicode-3.0 -I/opt/wx/3.0_unicode_monolithic_shared/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -O2 -Wextra -Wall -std=c++11 -c ~/Code/wxWidgets/dfedit-wx/interface/GeneralsTab.cpp -o obj/Release/interface/GeneralsTab.o
g++ -Wall -O2 -I/opt/wx/3.0_unicode_monolithic_shared/lib/wx/include/gtk3-unicode-3.0 -I/opt/wx/3.0_unicode_monolithic_shared/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -O2 -Wextra -Wall -std=c++11 -c ~/Code/wxWidgets/dfedit-wx/interface/wxDFeditApp.cpp -o obj/Release/interface/wxDFeditApp.o
g++ -Wall -O2 -I/opt/wx/3.0_unicode_monolithic_shared/lib/wx/include/gtk3-unicode-3.0 -I/opt/wx/3.0_unicode_monolithic_shared/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -O2 -Wextra -Wall -std=c++11 -c ~/Code/wxWidgets/dfedit-wx/interface/wxDFeditMain.cpp -o obj/Release/interface/wxDFeditMain.o
g++ -o bin/Release/wxDFedit obj/Release/interface/DFTab.o obj/Release/interface/GeneralsTab.o obj/Release/interface/wxDFeditApp.o obj/Release/interface/wxDFeditMain.o -s -L/opt/wx/3.0_unicode_monolithic_shared/lib -pthread -lwx_gtk3u-3.0
--- End code ---
Code::Blocks version is 119,976 bytes.
My version is 115,880 bytes.
What I'm not getting is just looking at the wx-config string that I can see in C::B and the one I've used in my make, they seem to be exactly the same (aside from having to add core, base, aui manually because it fails to link with just plain wx-config --libs alone). But, they are resulting in different application results. The sizes are different (no suprise given the compiling and linking is different), and the application is visually different. On my system, closeable tabs from wxWidgets apps such as C::B itself have a red circle with a white x. My make-d application has this same look. The C::B version has a rounded square outline with a black x. Also in both C::B and my make-d app, menu options with key accelerators are underlined, but in the C::B version of the app, they aren't.
I was assuming the wx-config options would get passed as-is to the compiler and linker, but, I guess something else is happening to result in different output?
oBFusCATed:
It seems that you're somehow calling two different versions of wx-config. One is gtk2 and the other is gtk3. Probably you are modifying the path variable somewhere in you cb settings (env var plugin?).
sorinev:
Yeah, and I don't get how that's happening. I haven't modified anything like that explicitly on my own, no. It's a standard svn build (10333) with contrib-plugins=all. Beyond that, I haven't changed anything important, just some syntax highlighting colors and maybe a couple of compiler switches (as in, just checkboxes). Is there somewhere that this can be shown?
stahta01:
--- Quote from: sorinev on June 20, 2015, 07:18:08 pm ---Yeah, and I don't get how that's happening. I haven't modified anything like that explicitly on my own, no. It's a standard svn build (10333) with contrib-plugins=all. Beyond that, I haven't changed anything important, just some syntax highlighting colors and maybe a couple of compiler switches (as in, just checkboxes). Is there somewhere that this can be shown?
--- End quote ---
On the command line.
What does this result in?
--- Code: ---which wx-config
--- End code ---
And, what does this result in?
--- Code: ---wx-config --list
--- End code ---
Edit: And, what does this result in?
--- Code: ---update-alternatives --config wx-config
--- End code ---
Tim S.
sorinev:
--- Code: ---me@Kubuntu-1404:~$ which wx-config
/opt/wx/3.0_unicode_monolithic_shared/bin/wx-config
me@Kubuntu-1404:~$ wx-config --list
Default config is gtk2-unicode-3.0
Default config will be used for output
Alternate matches:
base-unicode-3.0
Also available in /usr:
base-unicode-release-2.8
gtk2-unicode-release-2.8
me@Kubuntu-1404:~$ update-alternatives --config wx-config
update-alternatives: warning: /etc/alternatives/wx-config has been changed (manually or by a script); switching to manual updates only
There are 4 choices for the alternative wx-config (providing /usr/bin/wx-config).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/x86_64-linux-gnu/wx/config/gtk2-unicode-3.0 308 auto mode
1 /usr/lib/x86_64-linux-gnu/wx/config/base-unicode-3.0 307 manual mode
2 /usr/lib/x86_64-linux-gnu/wx/config/base-unicode-release-2.8 287 manual mode
3 /usr/lib/x86_64-linux-gnu/wx/config/gtk2-unicode-3.0 308 manual mode
4 /usr/lib/x86_64-linux-gnu/wx/config/gtk2-unicode-release-2.8 288 manual mode
--- End code ---
Navigation
[0] Message Index
[#] Next page
Go to full version