Posted: Sun Aug 12, 2007 8:27 pm Post subject: [HELP] Using Microsoft Visual C++ Express
I've tried to make a Hello World program using this compiler but I'm still having trouble. I choose File -> Project -> Win32 -> Win32 Console Application. Then I Finish, and the Hello World.cpp has loaded. I change the Hello World.cpp from
Code:
// Hello World.cpp : Defines the entry point for the console application.
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}
to
Code:
#include <iostream>
using namespace std;
int main( void )
{
Cout << "Hello World!!!" ;
return 0;
}
When I try to compile and run it, I keep getting and error. Please Help.
I'll check up on this tread tomorrow morning. _________________
What dosen't kill you, usually does the second time.
1. main takes argc and argv, and the CRT expects _tmain.
2. cout, not Cout. C++ is case sensitive, unlike the horrid language you're used to.
3. you have to look at the additional dependencies in stdafx caused by creating the project the way you did. You went through the wizard and told it to produce code, you're supposed to tell it to make your project empty, then go to "add file", then put your code in the new file. Or you can drop the whole IDE mess and compile using the command line tools. Much simpler that way. Faster also.
y use Win32? Just Use a Emptry CLR Project. and add a Source File
anywayz yea. Cout must be cout
u also might wanna leave void out of the brackets and add either cin.get(): or system("pause"); right before return 0; so u are able to read what ur output is
if u wanna use Win32
go to stdafx.h and add #include <iostream> in there. because thats what stdafx.h is there for. to hold any libraries used in your program.
i'de just stick with Empty CLR Projects to begin with.
after that u can move onto CLR Console Apps or Win32 _________________
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum