News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Problem compiling and running plain file ( on ubuntu)

Started by san_zoulapi, October 23, 2009, 08:13:20 PM

Previous topic - Next topic

san_zoulapi

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

oBFusCATed

(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

san_zoulapi

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.

koso

Have you saved that new file with proper C/C++ extension before compilation?

san_zoulapi

 It worked.....I thought the IDE would set the .cpp extension itself before compiling and i didnt think of it. Thx a lot