Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: TnTonly on March 22, 2009, 03:21:38 am

Title: Using MingW with Code::Blocks in Ubuntu
Post by: TnTonly on March 22, 2009, 03:21:38 am
I have googled everywhere but still didn't find any solution. Please help!

I am using Ubuntu 8.10, installing MinGW by using Synaptic, search for mingw and check both 3 of them

Then I config Code::Blocks exactly like this tutorial
http://wiki.codeblocks.org/index.php?title=Code::Blocks_and_Cross_Compilers

But when I compiling any HelloWorld, I just got a message "uses an invalid compiler [YOUR ANSWER IS ALREADY THERE. SEARCH THE FORUMS!]." and "Nothing to be done".

Thanks in advance!
Title: Re: Using MingW with Code::Blocks in Ubuntu
Post by: Jenna on March 22, 2009, 09:37:24 am
That means the toolchain for the compiler you have chosen for your project is incorrect.

Make sure you chose the correct compilername for the target you want to cross-compile.
Check the text box containing the compilers installation directory (master-path), the bin-part should not be included.

ATTENTION:
If you use the MinGW installed via synaptic the master-path most likely differs from the one in the wiki article.
The cross compilers (at least on debian-based systems) are installed in /usr/bin, only the libs and includes are in /usr/i586-mingw32msvc/.
(See also this article: http://wiki.codeblocks.org/index.php?title=Cross_Compiling_wxWidgets_Applications_on_Linux#Preparing_Code::Blocks (http://wiki.codeblocks.org/index.php?title=Cross_Compiling_wxWidgets_Applications_on_Linux#Preparing_Code::Blocks) .

Check the naming of your executables.

Try to call them from commandline:
Code
<master-path>/bin/<C++-compiler> -v

in my case (for c++-compiler):

Code
jens@debian-inspiron:~$ /usr/bin/i586-mingw32msvc-g++ -v
Using built-in specs.
Target: i586-mingw32msvc
Configured with: /home/ron/devel/debian/mingw32/mingw32-4.2.1.dfsg/build_dir/src/gcc-4.2.1-2-dfsg/configure -v --prefix=/usr --target=i586-mingw32msvc --enable-languages=c,c++ --enable-threads --enable-sjlj-exceptions --disable-multilib --enable-version-specific-runtime-libs
Thread model: win32
gcc version 4.2.1-sjlj (mingw32-2)
Title: Re: Using MingW with Code::Blocks in Ubuntu
Post by: TnTonly on May 15, 2009, 12:24:14 am
Well, this articles is pretty long for now, and when I came back, I was surprise I didn't thank you that time. It solved the problem.

But I can see not only I encountered this problem, because the guide in Code::Blocks wiki is incorrect (or not very correct) since it says the cross-compiler is installed in /usr/i586-mingw32msvc/bin but not /usr/bin (again, at least in debian system). So I think someone should edit this guide a little to be more precisely
http://wiki.codeblocks.org/index.php?title=Code::Blocks_and_Cross_Compilers

And, thank you again. I should tell you that few months ago ^^
Title: Re: Using MingW with Code::Blocks in Ubuntu
Post by: MortenMacFly on May 15, 2009, 08:32:39 am
So I think someone should edit this guide a little to be more precisely
http://wiki.codeblocks.org/index.php?title=Code::Blocks_and_Cross_Compilers
You know how a WiKi works, don't you?  You can add this information yourself. This would be of help for all of us.