Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: Sensei on June 13, 2013, 05:33:57 pm
-
Hello,
I managed to compile and setup wxWidgets on my Raspberry PI and now want to check whether I'm able to write a small Program using Code::Blocks in order to check that all went right.
The obligatory "Hello World" Program compiles and the release and debug build can be executed on clicking the corresponding buttons.
In the next step I compiled the wxWidgets Template provided with Code::Blocks and the compilation and linking prosses finished without errors.
If I try to execute the wxTemplate by clicking the "play" Button I get a red message that says that the process terminated with status -1.
I discoverd that I have to use ./wxTemplate to run that application from a linux shell. I understand that this happens because the executable isn't located in /usr/bin where the PATH variable points to. But I dont want to copy each build to /usr/bin in order to debug a application. So is there a possibility to setup my Code::Blocks projekt that executables can be run also if the are not in /usr/bin.
The other question is, why does my "Hello World" console application start without having this problem?
For any help I will thank you in advance.
Greetings
Sensei
-
pleas post the build log
-
Hi,
the build log won't show something unusual.
-------------- Build: Release in wxWidgetsTest ---------------
Compiling: wxWidgetsTestApp.cpp
Compiling: wxWidgetsTestMain.cpp
Linking executable: bin/Release/wxWidgetsTest Output size is 38,84 KB Process terminated with status 0 (2 minutes, 11 seconds)
0 errors, 0 warnings
This problem might occur at more Code::Blocks installations running on Linux machines.
Greetings
Sensei
-
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F
-
Hello,
her is the log in detail:
-------------- Clean: Release in wxWidgetsTest ---------------
Cleaned "wxWidgetsTest - Release"
-------------- Build: Release in wxWidgetsTest ---------------
g++ -Wall -I/usr/local/lib/wx/include/gtk2-unicode-release-2.8
g++ -I/usr/local/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES
g++ -D__WXGTK__ -pthread -O2
g++ -I../../../../../usr/local/include/wx-2.8 -I/usr/include/wx-2.8 -c
g++ /home/pi/Projekte/Software/wxWidgetsTest/wxWidgetsTestApp.cpp -o
g++ obj/Release/wxWidgetsTestApp.o -Wall
g++ -I/usr/local/lib/wx/include/gtk2-unicode-release-2.8
g++ -I/usr/local/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES
g++ -D__WXGTK__ -pthread -O2
g++ -I../../../../../usr/local/include/wx-2.8 -I/usr/include/wx-2.8 -c
g++ /home/pi/Projekte/Software/wxWidgetsTest/wxWidgetsTestMain.cpp -o
g++ obj/Release/wxWidgetsTestMain.o -L../../../../../usr/local/lib
g++ -L/usr/lib/arm-linux-gnueabihf -o bin/Release/wxWidgetsTest
g++ obj/Release/wxWidgetsTestApp.o obj/Release/wxWidgetsTestMain.o -s
g++ -L/usr/local/lib -pthread -lwx_gtk2u_richtext-2.8
g++ -lwx_gtk2u_aui-2.8 -lwx_gtk2u_xrc-2.8 -lwx_gtk2u_qa-2.8
g++ -lwx_gtk2u_html-2.8 -lwx_gtk2u_adv-2.8 -lwx_gtk2u_core-2.8
g++ -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8 -lwx_baseu-2.8
Output size is 38,84 KB
Process terminated with status 0 (1 minutes, 34 seconds)
0 errors, 0 warnings
Hope this helps.
Greetings
Sensei
-
The output looks pretty much messed up. There should not be g++'s on every row.
Can you compile simple console project on this machine?
-
Hi,
I don't know whether this went this way.
Here is the exaclty same build log as it is shown inside Code::Blocks:
-------------- Clean: Release in wxWidgetsTest ---------------
Cleaned "wxWidgetsTest - Release"
-------------- Build: Release in wxWidgetsTest ---------------
g++ -Wall -I/usr/local/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/local/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -O2 -I../../../../../usr/local/include/wx-2.8 -I/usr/include/wx-2.8 -c /home/pi/Projekte/Software/wxWidgetsTest/wxWidgetsTestApp.cpp -o obj/Release/wxWidgetsTestApp.o
g++ -Wall -I/usr/local/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/local/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -O2 -I../../../../../usr/local/include/wx-2.8 -I/usr/include/wx-2.8 -c /home/pi/Projekte/Software/wxWidgetsTest/wxWidgetsTestMain.cpp -o obj/Release/wxWidgetsTestMain.o
g++ -L../../../../../usr/local/lib -L/usr/lib/arm-linux-gnueabihf -o bin/Release/wxWidgetsTest obj/Release/wxWidgetsTestApp.o obj/Release/wxWidgetsTestMain.o -s -L/usr/local/lib
-pthread -lwx_gtk2u_richtext-2.8 -lwx_gtk2u_aui-2.8 -lwx_gtk2u_xrc-2.8 -lwx_gtk2u_qa-2.8 -lwx_gtk2u_html-2.8 -lwx_gtk2u_adv-2.8 -lwx_gtk2u_core-2.8 -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8 -lwx_baseu-2.8
Output size is 38,84 KB
Process terminated with status 0 (1 minutes, 34 seconds)
0 errors, 0 warnings
Hope this helps?
Greetings
Sensei
-
From this log I can't see any problem:
g++ -L../../../../../usr/local/lib -L/usr/lib/arm-linux-gnueabihf -o bin/Release/wxWidgetsTest obj/Release/wxWidgetsTestApp.o obj/Release/wxWidgetsTestMain.o -s -L/usr/local/lib
-pthread -lwx_gtk2u_richtext-2.8 -lwx_gtk2u_aui-2.8 -lwx_gtk2u_xrc-2.8 -lwx_gtk2u_qa-2.8 -lwx_gtk2u_html-2.8 -lwx_gtk2u_adv-2.8 -lwx_gtk2u_core-2.8 -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8 -lwx_baseu-2.8
Output size is 38,84 KB
Process terminated with status 0 (1 minutes, 34 seconds)
0 errors, 0 warnings
the pr0cess terminated with 0... It didn't work when you hit the green run button?
The other question is, why does my "Hello World" console application start without having this problem?
the hello world doesn't use any additional library. The wxWidgets application uses the wxWidgets library, so you have a dependence and if the executable can't find this library it will terminate with a error... I think this is happening with your application, but i can't say where the error is... If you run it from terminal it works? interesting... 90% of the errors are conversely.
-
Hi,
yes I'm also confused.
To run the wxWidgts test app I have to type ./wxWidgetsTestApp in a console window otherwise without ./ it the program will not be executed.
The HelloWord programm can be started by clicking the green run butten but from the console I also need the ./ to execute it.
The fact that ./wxWidgetsTestApp starts the application I would think that the libs can be found but I'm not 100% sure.
My PATH looks like:
/usr/lib/arm-linux-gnueabihf/libfm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usrbin:/sbin:/bin;/usr/local/games:/usr/games:/
The wx-Libraries are located in /usr/local/lib. This directory in detail is not converd in the path variable, but Im not sure that this is the problem.
I think I will try out in adding it to the path variable.
Greetings
Sensei
-
Hi,
UPDATE:
I did:
PATH=$PATH:/usr/local/lib
exoprt PATH
Unfortunately this didn't solve the Problem and I still can not execute the wxWidgetsTestApp by clicking the green run button.
I hope someone out there has further ideas?
Greetings
Sensei
-
set LD_LIBRARY_PATH?
-
If you are in the same folder as the app, you always need the ./ on linux.
It's linux specific and has nothing to do with C::B
-
Hi,
If you are in the same folder as the app, you always need the ./ on linux.
It's linux specific and has nothing to do with C::B
Yes, thats what I thought also, but my question is why I cant run the app by clicking the green run button?
Can this have something to do that I build wxWidgets as shared libraries and have to set some path inside C::B?
Greetings
Sensei
-
try to change the terminal in Settings->Environment Settings->General Settings->Terminal to launch console programs
-
Hi,
got it to work.
I deleted the projekt file and setup the projekt again. Selecting advanced Options and then dynamic lib.
Recompiled and now it runs from inside C::B.
I think the problem was the projekt configuration related to the wxWidgets paket distributed with raspbian. After a self compiled wxWidgets the the configuration of the wxSystem was changed.
Thanks for all helping with posts and tips
Greetings
Sensei