Results 1 to 4 of 4
hi, i´m trying to compile some very basic code in mandriva 2009,i´ve started to learn about c++ programing a couple of months ago in windows with microsoft visualc++ without any ...
- 03-08-2009 #1Just Joined!
- Join Date
- Mar 2009
- Posts
- 2
Can´t compile in linux
hi, i´m trying to compile some very basic code in mandriva 2009,i´ve started to learn about c++ programing a couple of months ago in windows with microsoft visualc++ without any kind of problems,however in linux none of those code get compiled(i´ve instaled g++).
Perhaps i´m not doing the right command(/home/emanuel/Desktop/1cp.cpp g++) or i´m missing something that ´s not instaled.
also i get always these error while trying to compile:
line 3: syntax error near unexpected token´('
line 3: ´int main(void)'
In function ìnt main()':
5:error: ´cout´was not declared in this scope
This is the code :
#include<iostream>
int main(void)
{
cout << "hello World\n";
}
But those error occur in every single code,and when it doesn´t hapen, it simple just doesn´t appear nothing in the next line , not even [emanuel@localhost ~ ]$sow i´m stucked and completly confused and can´t go any further in C++
Any help regarding these problems would be very thankfull since i stucked here for two weeks now!
- 03-08-2009 #2Just Joined!
- Join Date
- Mar 2009
- Posts
- 8
#include<iostream>
using namespace std;
int main()
{
cout<<"HELLO WORLD";
retrun 0;
}
try this .....
- 03-08-2009 #3Just Joined!
- Join Date
- Mar 2009
- Posts
- 2
sow i think it worked but i´m not sure ,after compiling just came back [emanuel@localhost~] $ ,how do see the output and where can i find the compiled code?
thanks for helping
- 03-08-2009 #4Just Joined!
- Join Date
- Feb 2009
- Posts
- 45
Answer:
I advise you to become more acquainted with the compiler you plan to use before actually using it.¹
Originally Posted by Azzizz
The GCC-option you are probably looking for is “-o”, which determines the name of the output binary:
Footnotes:Code:$> g++ SOURCE.cpp -o mybinary; $> ./mybinary; Hello world


Reply With Quote