Reddoug
July 13th, 2018, 03:27 AM
Hello
I am trying to figure out why I am getting errors when trying to run Hello World C++ program. I have tried to find a solution but I am not able to.
1 #include <iostream>
2
3 int main(int argc, char *argv [])
4 {
5 std::cout << "Hello World!" << std::endl;
6
7 return 0;
8 }
Error
./helloworld.cpp: line 3: syntax error near unexpected token `('
./helloworld.cpp: line 3: `int main(int argc, char *argv [])'
I used gcc helloworld.cpp -o helloworldcpp to compile in Ubuntu. Don't see why it works in Code Blocks in Windows but not Ubuntu.
I used ./helloworld.cpp to try and run it. Permissions were changed to 755
I also tried to create with C and I get the same error when trying to run it.
1 #include <stdio.h>
2 int main(int argc, char *argv[])
3 {
4 printf("Hello World!\n");
5 return 0;
6 }
./helloworld.c: line 2: syntax error near unexpected token `('
./helloworld.c: line 2: `int main(int argc, char *argv[])'
Stumped
Doug
I am trying to figure out why I am getting errors when trying to run Hello World C++ program. I have tried to find a solution but I am not able to.
1 #include <iostream>
2
3 int main(int argc, char *argv [])
4 {
5 std::cout << "Hello World!" << std::endl;
6
7 return 0;
8 }
Error
./helloworld.cpp: line 3: syntax error near unexpected token `('
./helloworld.cpp: line 3: `int main(int argc, char *argv [])'
I used gcc helloworld.cpp -o helloworldcpp to compile in Ubuntu. Don't see why it works in Code Blocks in Windows but not Ubuntu.
I used ./helloworld.cpp to try and run it. Permissions were changed to 755
I also tried to create with C and I get the same error when trying to run it.
1 #include <stdio.h>
2 int main(int argc, char *argv[])
3 {
4 printf("Hello World!\n");
5 return 0;
6 }
./helloworld.c: line 2: syntax error near unexpected token `('
./helloworld.c: line 2: `int main(int argc, char *argv[])'
Stumped
Doug