Public Group

# Visual C++ (Visual Studio 2003)

This topic is 5450 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

A couple of things, please bear with me. I'm still new to C++ (although have experience with PHP/Delphi for years), I started with Dev-C++ and was going to focus on cross-platform. But this is a bit daunting I guess, so I've decided to go MSVC++ with DirectX and going to learn in this first as I primarily use Win32 systems anyway. I can work on cross-platform later on. Does anyone know of a good MSCV++ specific tutorial? For just simple programs. I've tried a tutorial that says to just start a new win32 console project, tell the app wizard to make the project empty, then add a new cpp file. I did this and entered some very basic code.
#include <iostream>

int main(void) {
cout << "Hello World!";
return 0;

}


This won't compile (I haven't got error message with me as I left that at home this morning). Yet this works fine with Dev-C++ and looks like perfectly valid c++ to me. If I go through the wizard and let it make the first few files it creates a file, very similar, and stdafx.h and stdafx.c (or something like that) which just contains iostream and tchars includes. The hello.c it makes contains pretty much the same code as above, yet this compiles. So if anyone does have a good tutorial on how to properly make a basic c++ program in MSVC++ it'd be much appreciated. Managed vs Unmanaged I've installed the DirectX9 SDK as I want to get into that eventually. However I keep seeing references to the above, unmanaged and managed. What IS the difference? I saw another thread which basically said it's just down to the way it compiles? I'd like to know what the difference is in terms of how you code? (Examples please?) P.S. If anyone wants to communicate over quicker medium I do have MSN at work.  I also forgot to ask, I've download the SDK Extras and Symbols etc too, for fullness. But they don't come with any documentation on how to install these into the SDK (DirectX). They just extract to folders. Anyone?
Fruny - edited source tag [Edited by - Fruny on October 15, 2004 4:42:48 AM]

##### Share on other sites
I tried your code with both, Visual C++ (2003) and Visual C++ 6.0

with the V6.0 it works perfectly without any warning or error.
But in the newer version (2003) it doesn't work complaining there is no such headerfile found.

##### Share on other sites
Like all standard library components, cout is located in the std namespace. Either do provide a fully qualified name:

#include <iostream>int main(void) {  std::cout << "Hello World!";  return 0;}

import the symbol into the global namespace with a using-declaration,

#include <iostream>using std::cout;int main(void) {  cout << "Hello World!";  return 0;}

or import the entire std namespace into the global namespace with a using-directive.

#include <iostream>using namespace std;int main(void) {  cout << "Hello World!";  return 0;}

##### Share on other sites
I'll dig out the code it says to put in and post it monday (no internet at home). It complains about more than just a header file.

using namespace std;

Will fix the earlier code.

##### Share on other sites
Another common mistake: If it complains about an unresolved external "WinMain", then you've set it up to create a "Win32 Application" instead of a "Win32 Console Application".

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 13
• 14
• 40
• 63