Everytime I try to "Hello World", I always get an error stating that the program is illeagel. Considering syntax errors. Now I'm getting one saying I need a 32-bit computer. This is how I've been writing the "Hello World":
/*void*/ int main() // main *must* return int
cout << "Hello world." << endl;
return 0 ; // exit from main
// nothing that you write here will execute; main() has already returned
Thanks. But now I'm getting a message saying that my program is not compatible with the type of Windows I'm running. I am on a 64-Bit laptop so is there any way that I can change the program? (I'm using Notepad, would I need to use VC++E?)
What compiler are you using? Notepad is just a text editor. If you're using a compiler such as g++, you simply run a command like this:
That should compile it for you. Then you simply run the code as follows:
These are very basic commands and can result in issues when you do more programming, but to get the simple hello world compiled, it should suffice. Make sure you change main to whatever the name of your C++ file name is.
I don't use Code::Blocks because ti confuses me. I used VC++E for the program, but it said that the program did not exist after I debugged and ran it. I guess I'll just look it up on youtube how to use VC++E. Maybe that could help.
I've never heard that statement when compared to MSVCE. Typically, beginners are more confused by MSVCE than C::B because there is so much going on in MSVCE. If you download the 10.05 version from codeblocks.com, it comes already set up for you. You can even select a console application from the new project list that already has a simple hello world program written for you (as a test to make sure everything installed correctly).
You also don't need system pauses (which if you read about the system function, you understand why this is a good thing). Aside from that, C::B is a much lighterweight IDE than MSVCE IMHO. This comes in handy for beginners because there isn't too much on the screen at once to overwhelm you. You have an editor window, a few toolbars (to make it easy to access commonly used commands), and a log window to see what's going on.
I'd honestly try to stick with a basic text editor (like notepad or something better) and just download a separate compiler. This will allow you to completely customize your programs the way you want them without having to fight with the IDE.
Once you run it, it asks you several questions. Make sure you select atleast g++ (I'd also suggest selecting gcc as well). This takes several minutes depending on your internet connection. Once it finishes, it will have installed everything you told it to download. You can then use the compiler 1 of 3 ways.
1) You can add the path of the compiler to the System PATH (some people frown upon this) but this can be a little tricky. Make sure you don't erase anything in there, if you have doubts about doing it, click cancel and nothing is saved.
2) You can manually call the compiler from the command line as so (assuming you used the default install location):
Then run it as so:
You have a very wide range of options when it comes to compilers/environments, but I suggest using the g++ compiler since I'm not even 100% what the commands for MSCVE compiler are.