Visual Studio - Creating a new Win32 Console Application:
This information is for Visual Studio 2005. The 2008 version may be different. Let us assume you have a directory "MyProject", containing the source code (.c, .cpp, or .h) files for your project.
- Start Microsoft Visual Studio
- Select "File → New → Project..."
- This will bring up a window "New Project".
- Under "Project Types" section, open the "Visual C++" tab and select "Win32".
- Under "Templates" section, select "Win32 Console Application".
- Under "Name", enter your solution name (e.g., "MySolution")
- Under "Location", enter the path of the directory "MyProject" (or use Browse to navigate here).
- Uncheck the box "Create a directory for solution".
- Click "OK".
- Next a window "Win32 Application Wizard" will come up.
- Click the "Application Settings" button on the left.
- Under "Application type" be sure that "Console application" is selected.
- Under "Additional options" select "Empty project".
- Click "Finish".
- This will create a directory "MySolution" (within "MyProject") with a number of files, including:
- MySolution.sln (solution file).
- MySolution.vcproj (records compiler options for the project).
- ...and a few others.
- Returning back to the Visual Studio main window, go to the "Solution Explorer" section (probably on the left) and click "MySolution".
- Select "Project → Add Existing Item..." (Alternatively, you can right-click "MySolution" in the Solution Explorer window and select it from here.
- This will bring up a window "Add Existing Item". Navigate to your "MyProject" directory and (using control-click) select all your source files.
- Click "Add". (In the Solution Explorer section, you should now see your .h files listed under "Header Files" and your .c and .cpp files listed under "Source Files".)
- To view/edit a file, double-click on it.
- If you need to set additional configuration options (e.g., directories to search for include files or .lib files).
- Select "Project → MySolution properties...".
- This will bring up a window with lots of sections for various options.
- For example:
- If you want to select directories to search for header files select "C/C++ → General" and add these in "Additional Include Directories".
- If you want to select directories to search for library files select "Linker → General" and add these in "Additional Library Directories".
- If you want to debug your program, you may want to select "Debugging" add set any command-line arguments or alter the working directory.
- To compile:
- Select "Build → Build Solution" (or hit F7).
- Note that the compiler allows for two common compiler configurations.
- "Debug" adds additional debugging information to the compiled code.
- "Release" performs additional code optimization.
- To run (in debug mode):
- Select "Debug → Start Debugging" (or hit F5).
- To clean compilation files:
- Select "Build → Clean Solution"
- (I would suggest deleting the file "MySolution.ncb", which is quite large, and is not needed to recompile your program.)
|