Hello World

Nov 11, 2015 at 10:57pm
I thought that the hello world program was just a matter of typing "print hello world" which was so easy and now I just figured out that you are spose to have it displayed on your screen...I cant get it to work ive been looking at forums for a good hour tinkering with my code a bit and still cant make it work which is derailing seeing as this is the first program you write :(
1
2
3
4
5
6
//Prints "Hello World!" to screen
#include "std_lib_facilities.h"
int main(){
	std::cout << "hello World!" \n;
	return 0;
}

Nov 11, 2015 at 11:00pm
.I cant get it to work

Can you be more specific? Does your console window not stay open? Are you getting compilation errors? Linking errors?
Nov 11, 2015 at 11:03pm
Sorry for the confusion, I assumed you would get same error as me when you run it....
I get a few errors...syntax error, unexpected tolken, events not found, syntax error new unexpected tolken
Nov 11, 2015 at 11:05pm
Im running on MacOS is this why im having a problem??
Nov 11, 2015 at 11:08pm
What is the first error your compiler generates when you compile? Is it able to open the include file?
Nov 11, 2015 at 11:14pm
Ill copy paste the return errors I get...Im fairly sure that its opening the file I downloaded I dont know if i should refer to it better maybe that will help...

1
2
3
4
5
6
7
8
9
10
11
Ahsans-MacBook-Pro:~ Onecent$ //Prints "Hello World!" to screen
-bash: !": event not found
Ahsans-MacBook-Pro:~ Onecent$ #include "std_lib_facilities.h"
Ahsans-MacBook-Pro:~ Onecent$ int main(){
-bash: syntax error near unexpected token `('
Ahsans-MacBook-Pro:~ Onecent$ std::cout << "hello World!" << \n;
-bash: !": event not found
Ahsans-MacBook-Pro:~ Onecent$ return 0;
-bash: return: can only `return' from a function or sourced script
Ahsans-MacBook-Pro:~ Onecent$ }
 
Nov 11, 2015 at 11:18pm
This is not the output of a C++ compiler.
Nov 11, 2015 at 11:26pm
haha wow I look stupid im doing it wrong then...why cant I run it in my terminal, im writing code with sublime and copypasting it to terminal. I was led to believe I could do it all there...I have honestly just been doing python things like boolean values and lots of integers and greater than less than for loops, while loops, list, ect ect ect....
anyways I guess ill go look at tutorials see what I missed argg
Topic archived. No new replies allowed.