HELP simple Hello World in codeblock won't run in Mac

Im a newbie and want to learn writing c/c++ programs..
i have a Mac OS X Yosemite 10.10.5
and just downloaded the new version of Code::Block 13.12

the simple program i write is:

1
2
3
4
5
6
 #include <stdio.h>
main ()
{
   printf (" Hello World!"\n);
   return 0;
} 



when i run the program, this will show:

/Volumes/MYBOOK/C:C++ Files/hw
-bash: /Volumes/MYBOOK/C:C++: No such file or directory
-------------
also,

/Volumes/MYBOOK/C:C_2 error: C++ requires a type specifier for all declarations
===Buil failed: 1 error(s), 0 warning(s) (0)minute(s), 1 second(s)) ===


i tried saving in .c or .cpp
but nothing works..

I don't know where the problem is.. pls. help...
Last edited on
main() must be type int.

PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
In your code, the quotes in printf line are at the wrong place. It should go:

printf (" Hello World!\n");
thanks for the reply..
I have all tried your suggestions..and write like this:

---------------------------

1
2
3
4
5
6
#include <stdio.h>
int main()
{
    printf(" Hello World!\n");
    return 0;
}




------------------------------
it still won't run. i have this message:

/Volumes/MYBOOK/C:C++ Files/Untitled2
-bash: /Volumes/MYBOOK/C:C++: No such file or directory
------------------------------------------

plus the worst thing was... it the code::bocks CRASHES after i run the simple program.. ;((

Last edited on
Topic archived. No new replies allowed.