Hi, I normally post at the IGN boards for games, but recently I semi-quited games(school reasons) and thought of getting serious with C++ because I want to become a game designer in the future. I know its going to take a lot of hard work and time but I know I can do it. My favorite games are Zelda: OOT, Chrono Trigger/Cross, Xenogears, al Final Fantasies, and Earthbound.

Nice to meet you guys. :D ... :twisted:

Now here is my question.

Im doing the traditional first program, known as "Hello World"

I type this on the editor:

#include <iostream>
               //tells me there  is an error on this line, which is blank
int main()
{
    std::cout << "Hello World!\n";
    return 0;
}

I compile it and it says that there is an error. I am also trying to save the compiled code to an obj. file so I can link it but there isnt an option to save it as that. can you help me out? I am using a downloaded version of Dev-C++ btw and the book I am using is 'Sams Teach Yourself C++ 4th edition in 21 days'.

Edited 3 Years Ago by pyTony: fixed formatting

Welcome aboaord Labombadog.

I am no programmer, but there are many in the forums; masters and wannabees alike.
I would suggest digging through some code snippets on daniweb.. you can
search them in the "Search for:" box at the top of the page and pull down to
"code snippets" to the left of it. I usually have better luck in the forums. Tons of
examples out there.

Good luck on your hunt.

>My favorite games are Zelda: OOT, Chrono Trigger/Cross, Xenogears, al Final Fantasies, and Earthbound.
I like you already. :) Might I also suggest Xenosaga, Lunar, Lunar 2, Wild Arms, Tales of Destiny, and Tales of Symphonia?

>I compile it and it says that there is an error.
The code is fine, so it would help if you copy/pasted the error that you're getting. That way we can have a better idea of what's not right.

>I am also trying to save the compiled code to an obj. file so I can link
With an IDE, linking will happen automagically if you have a project set up. You typically only have to deal with object files when using a command line compiler and makefiles.

>but there isnt an option to save it as that.
The result of the compilation process is an object file, which is then processed by the linker to create an executable file. So there's no need to save anything as an object file because that's what your compiler gives you as a part of the normal process.

^That was 'one' of my guesses.

Btw, Tales Of Symphonia rocks, I beat it not too long ago. :cheesy:

I cant use this comp for coding because my pop's is somewhat tripping.
But I am still going to study the book, no doubt about that. Me and my girl is suppose to move together soon(March or April) and she owns a laptop so w00t for me. :cool:

Narue and Cain, you guys are on my B/L. ;)

Hi, I normally post at the IGN boards for games, but recently I semi-quited games(school reasons) and thought of getting serious with C++ because I want to become a game designer in the future. I know its going to take a lot of hard work and time but I know I can do it. My favorite games are Zelda: OOT, Chrono Trigger/Cross, Xenogears, al Final Fantasies, and Earthbound.

Nice to meet you guys. :D ... :twisted:

Now here is my question.

Im doing the traditional first program, known as "Hello World"

I type this on the editor:

#include <iostream>
               //tells me there  is an error on this line, which is blank
int main()
{
    std::cout << "Hello World!\n";
    return 0;
}

I compile it and it says that there is an error. I am also trying to save the compiled code to an obj. file so I can link it but there isnt an option to save it as that. can you help me out? I am using a downloaded version of Dev-C++ btw and the book I am using is 'Sams Teach Yourself C++ 4th edition in 21 days'.

Either the line has to be,

#include <iostream.h>

or

#include <iostream>
using namespace std;

Edited 3 Years Ago by mike_2000_17: Fixed formatting

Comments
Read the rules please!
Dont ressurect old, dead and buried topics. =/

Your code is fine, can you paste the compiler error?

This thread has been dead for years. I'm sure the OP has either solved it or not longer cares.

This article has been dead for over six months. Start a new discussion instead.