Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: san_zoulapi on October 23, 2009, 08:13:20 pm

Title: Problem compiling and running plain file ( on ubuntu)
Post by: san_zoulapi on October 23, 2009, 08:13:20 pm
Hello I'm new to ubuntu (and linux generaly) and am presently trying to use code::blocks on Uuntu 9.04 for simple school projects on c++. I installed the package without getting any errors , created a new empty file and typed a simple hello world program:

#include <iostream>
using namespace std;

int main ()
{
  cout << "Hello World!";
  return 0;
}

After clicking on build --> compile (and setting the text file executable manualy-did not find other way of rendering it possible to execute ) , and then Run , I get the following message :

/home/username/filename:2:using:not found
/home/username/filename: 4 : Syntax error: "(" unexpected

Press ENTER to continue.

The same error apears every time i try to compile/run other sources that work on windows dev for example. Any help? Thx
Title: Re: Problem compiling and running plain file ( on ubuntu)
Post by: oBFusCATed on October 23, 2009, 08:26:22 pm
Do you have a compiler? gcc, g++?
Title: Re: Problem compiling and running plain file ( on ubuntu)
Post by: san_zoulapi on October 23, 2009, 09:23:24 pm
Yes i have them installed and working. I tried manually compiling the text file using gcc via the terminal  (after adding a .cpp extension to it) and it worked fine.
Title: Re: Problem compiling and running plain file ( on ubuntu)
Post by: koso on October 23, 2009, 09:37:01 pm
Have you saved that new file with proper C/C++ extension before compilation?
Title: Re: Problem compiling and running plain file ( on ubuntu)
Post by: san_zoulapi on October 23, 2009, 09:46:40 pm
 It worked.....I thought the IDE would set the .cpp extension itself before compiling and i didnt think of it. Thx a lot