Here I am after having lost 20 minutes of work replying to you because this stupid site lost my post and locked up or something. Now I'll type this first in Word then paste it. I hate losing my work. My fault really. I've lost tons of work replying on this site.
Anyway, you need to make a folder/directory for you project, then navigate there with the command prompt and change directory commands, because the Visual Studio or SDK command prompt will likely open up to some nasty place within which you might not want to code. I'll tell you what I always do. I don't think its the recommended thing to do, but I do it anyway, because I'm old fashioned and don't mind doing thigs my way.
I make a directory right off my C:\ drive like so...
C:\Code
Then I create subdirectories for all the various programming languages and tools I use. In the case of Visual Studio I have this...
C:\Code\VStudio\VC++9\x64
etc.
So if we want to make a test program to get you started command line compiling lets make this folder...
C:\Code\VStudio\VC++9\x64\Test
So you'll want to navigate to there with your Visual Studio or SDK command prompt using Change Directory commands like so....
C:\.....\......\.....\:\>CD [ENTER]
C:\>
C:\>CD C:\Code\VStudio\VC++9\x64\Test [ENTER]
So it should look something like this...
C:\Code\VStudio\VC++9\x64\Test:\>
Now try to see if cl.exe is working for you to make sure vcvarsall has set your paths right. Execute this...
C:\Code\VStudio\VC++9\x64\Test\:>cl /? [ENTER]
That's the command to output command line compiling switches for cl.exe. You'll need to press [ENTER] a few times to get through it.
If you don't get the correct output then something is wrong with your paths. Make sure you have the right shortcut you are executing from your Start Menu. Assuming cl.exe is working for you, our next step is to simply type in some source code in a *.cpp file in our working directory as set up above. So let's do Dennis Ritchie's original Hello, World! program. Open up Notepad and save this file to Hello.cpp in the directory we've set up above...
1 2 3 4 5 6 7 8 9
|
#include <stdio.h>
int main()
{
printf("Hello, World!\n");
getchar();
return 0;
}
| |
Having done whatever is necessary to save that to Hello.cpp execute this at the command prompt...
cl Hello.cpp [ENTER]
That's it. The compiler will grind for a few seconds, spit out some output, and you should end up with Hello.obj and Hello.exe in your working directory. Let me know how it goes.