Author Topic: How do I set up code::blocks to compile C++ in ubuntu?  (Read 9637 times)

Offline ausairman

  • Multiple posting newcomer
  • *
  • Posts: 12
How do I set up code::blocks to compile C++ in ubuntu?
« on: June 20, 2011, 06:05:34 am »
Hi everyone,
I'm new to code blocks as well as ubuntu, so please bear with me. I've installed code::blocks and loaded a .dev project file that I created with bloodshed dev c++ in windows 7. This seemed to work after a bit of fiddling.

Anyway I now want to compile the code. So when I click on compile is says:

""Project1 - default" uses an invalid compiler [YOUR ANSWER IS ALREADY THERE. SEARCH THE FORUMS!]. Probably the toolchain path within the compiler options is not setup correctly?! Skipping..."

So apparently the problem is that i haven't set up my toolchains. So I go to Settings->Compiler and debugger-> then I switch "GNU GCC compiler" to "Intel C/C++ Compiler" and click on "Toolchain executables". Under "Compiler's Installation directory" I have /opt/intel/cc/9.0. This folder is empty; presumably that's the source of my problem. In my synaptic package manager it does say that "g++-4.5" is installed. So how do I point to it? When I click on properties and "Installed files" it comes up with a massive list of directories, so I wouldn't know where to point it...

thanks in advance for the help
Ubuntu 11.04 (64-bit), optiplex 990 i7

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: How do I set up code::blocks to compile C++ in ubuntu?
« Reply #1 on: June 20, 2011, 06:43:03 am »
I have /opt/intel/cc/9.0. This folder is empty; presumably that's the source of my problem. [...]

In my synaptic package manager it does say that "g++-4.5" is installed.
What makes you believe that Intel compiler suite == GNU GCC compiler suite? These are two completely different things. Select the RIGHT compiler you want to use, then setup the path correctly.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline ausairman

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: How do I set up code::blocks to compile C++ in ubuntu?
« Reply #2 on: June 20, 2011, 06:53:23 am »
Well, I used to compile my code in bloodshed dev c++ on windows 7, which uses the mingw compiler. I was assuming that I could just use the intel c++ libraries and the code would still work (at least with minimal modifications) in Ubuntu once compiled. Is this not a valid assumption?
Ubuntu 11.04 (64-bit), optiplex 990 i7

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: How do I set up code::blocks to compile C++ in ubuntu?
« Reply #3 on: June 20, 2011, 09:26:11 am »
Is this not a valid assumption?
In general: No. It depends heavily on your code. Yo can easily write code in MinGW that won't compile with Intel and vice versa. So you should first decide what setup you want, or be sure you follow the restrictions as required not to mix incompatible code.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ