Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: r0xtehem0x on November 17, 2009, 02:26:35 am

Title: C Console App and GCC Linking
Post by: r0xtehem0x on November 17, 2009, 02:26:35 am
I'm on Ubuntu 9.10 and just installed C::B 8.02.  I used the wizard to make a C console application (not C++).  When I went to compile my project, the files compiled properly except they wouldn't link.

Code
Linking console executable: bin/Debug/myShell
/bin/sh: g++: not found
Process terminated with status 127 (0 minutes, 0 seconds)
0 errors, 0 warnings

Why is C::B defaulted to set up to use g++ on a C application?

Anyway, I have been searching to change the linking options of a project, but cannot find it.  I want to change code blocks to use gcc -o instead of g++.
Title: Re: C Console App and GCC Linking
Post by: Jenna on November 17, 2009, 06:58:24 am
It's set up in "Settings -> Comiler and debugger... -> Global compiler settings -> [the_compiler_you_use] -> Toolchain executables".

But be aware:
if you use gcc for linking, you might not be able to link c++-apps.
The better way is to install g++ also (it's in a seperate package).

Otherwise, you might run into trouble, if you decide to develop c++ apps in the future and have changed the linker-executable to gcc.
Title: Re: C Console App and GCC Linking
Post by: r0xtehem0x on November 17, 2009, 09:21:15 am
Thank  you, that is what I needed.
I was just curious on why code blocks doesn't have separate settings for C linker and C++ linker.  I guess it doesn't really matter when you have g++ installed.  For a situation though where you have gcc installed but not g++ on a computer where you don't have administrative rights to install new apps there may be a problem.  Although, I guess it would be up to the administrator to make the changes to code blocks to get it to link correctly with gcc and not g++.
Title: Re: C Console App and GCC Linking
Post by: Jenna on November 17, 2009, 11:08:19 am
Although, I guess it would be up to the administrator to make the changes to code blocks to get it to link correctly with gcc and not g++.

The settings are saved below the users home-directory (~/.codeblocks/default.conf).