Skip to main content
GameDev.net gamedev.net
🔒 Locked

Running this really simple C++ app

Started by DaveGiant Jan 4, 2009 at 5:13 AM 5 replies 950+ views
Original Post
DaveGiant
DaveGiant
How do I compile and run the following code?

// a small C++ program
#include <iostream>

int main()
{
    std::cout << "Hello, world!" << std::endl;
    return 0;
}
I have the visual C++ 2008 Express Edition IDE. What kind of app should I be making and how do I get this going?
PierreD
PierreD
I've never really used Visual C++, but you probably want to make a new empty project, add a source file, write your code, and compile it.
gan
gan
Quote:
Original post by DaveGiant
How do I compile and run the following code?

// a small C++ program#include <iostream>int main(){    std::cout << "Hello, world!" << std::endl;    return 0;}


I have the visual C++ 2008 Express Edition IDE.

What kind of app should I be making and how do I get this going?


File>New>Project>Visual C++>Win32>Win32 Console App
At wizard, under 'Additional Option', check "Empty Project" and later, right click the "source" folder and add the "C++ source file'. Paste the code above, will do.
Catkill
Catkill
in visual studio 2008 remember to add :

#include "stdafx.h"

at the top or it gives an error

Hope it helps

Catkill
agm_ultimatex
agm_ultimatex
Quote:
Original post by Catkill
in visual studio 2008 remember to add :

#include "stdafx.h"

at the top or it gives an error

Hope it helps

Catkill


If he creates an empty project, that will not be a problem. Thats only required if you use precompiled header option.
starvinmarvin
starvinmarvin
Or simply remove all stdafx stuff and disable precompiled headers in VC++ und Project Settings -> C/C++ -> Precompiled Headers
Kenny77
Kenny77
Quote:
Original post by PierreD
I've never really used Visual C++, but you probably want to make a new empty project, add a source file, write your code, and compile it.


Do this, it's the easiest way. Hit F5 to compile.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.