User forums > Help
c++11 compilation
MortenMacFly:
--- Quote from: saperlipopette on October 31, 2012, 11:02:56 am ---As told in my last post, the same program compiles and runs from the command line (see the results in the last quoted block).
--- End quote ---
Then inspect the full command lines of both compilation processes (which you didn't provide) and see the differences. Also make sure you are using the same compiler and libs. Finally verify you are starting in the same path in case you access files, for example.
There is technically not other reason than that why it behaves differently.
saperlipopette:
--- Quote from: MortenMacFly on October 31, 2012, 01:07:42 pm ---Then inspect the full command lines of both compilation processes (which you didn't provide) and see the differences. Also make sure you are using the same compiler and libs. Finally verify you are starting in the same path in case you access files, for example.
There is technically not other reason than that why it behaves differently.
--- End quote ---
Thanks for the tips.
Can you give me a clue of how to process these inspections? I'm totally new to CodeBlocks.
Regards, Olivier
MortenMacFly:
--- Quote from: saperlipopette on October 31, 2012, 01:48:44 pm ---Can you give me a clue of how to process these inspections? I'm totally new to CodeBlocks.
--- End quote ---
> Then inspect the full command lines of both compilation processes [...]
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
...the console output you should have / see have.
> you are using the same compiler and libs
> starting in the same path in case you access files, for example.
I am not a Linux user - for this I cannot tell you exactly... except that they also matter on that platform. On Windows, I would use a process explorer to find out. Sorry.
saperlipopette:
Thanks very much for helping.
I have inspected the full command lines of both compilation projects as advised. They are different.
codeBlock does this (and it fails):
g++-4.7 -Wall -fexceptions -g -std=c++11 -lpthread -c /home/olivier/codeblocks_projects/essai1/main.cpp -o obj/Debug/main.o
g++-4.7 -o bin/Debug/essai1 obj/Debug/main.o
On the console, I do this (and it works):
g++-4.7 -std=c++11 /home/olivier/codeblocks_projects/essai1/main.cpp -o /home/olivier/codeblocks_projects/essai1/bin/Debug/main -lpthread
I understand very little to these lines. My past C++ experience was exclusively on Microsoft Visual Studio, where I simply ignored what was done in the background when clicking the build button.
Note that CodeBlock successfully build and link any single-threaded project. Only the multi-threaded projects hang.
Alpha:
--- Quote from: saperlipopette on October 31, 2012, 08:23:30 pm ---g++-4.7 -Wall -fexceptions -g -std=c++11 -lpthread -c /home/olivier/codeblocks_projects/essai1/main.cpp -o obj/Debug/main.o
--- End quote ---
It looks like you added -lpthread to the "Other options" tab, however, this is linker related (and the "Other options" tab is for compile time options). Remove it, then under the "Linker settings" tab, add pthread to link libraries.
--- Quote from: saperlipopette on October 31, 2012, 08:23:30 pm ---I understand very little to these lines. My past C++ experience was exclusively on Microsoft Visual Studio, where I simply ignored what was done in the background when clicking the build button.
--- End quote ---
I would recommend doing some background reading on the compile -> link process, if you are unfamiliar with it.
--- Quote from: saperlipopette on October 30, 2012, 11:27:43 pm ---* I plugged the PPA and made a sudo apt-get update. The system actually downloaded some stuff from the new PPA but CodeBlock is still the 10.05. What did I miss?
--- End quote ---
I am relatively new to Ubuntu, but if I had to guess, this may be a 32 / 64 bit issue. I think that PPA only has 32 bit packages, so you will probably have to uninstall your current Code::Blocks, then specifically install the 32 bit package. ( -- Can any other Ubuntu users confirm this?)
--- Quote from: saperlipopette on October 30, 2012, 11:27:43 pm ---* BUT: This multithread project hangs when starting the thread.
--- End quote ---
... technically, I do not think it should even have been able to compile... but who am I to argue with GCC ;).
By the way, all the directions I have been giving you have been for global settings. In the long run, it is better practice to use project settings (except for the toolchain executables, which must be global... per-project toolchain executables makes no sense).
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version