0% found this document useful (0 votes)
38 views

Win 32 Console: How To Compile Code in Visual C++ 2005 Express Edition

To compile C code in Visual C++ 2005 Express Edition: 1. Create a new C project and solution; 2. Add and rename the main C file; 3. Press F7 to compile, resolving any precompiled header errors.

Uploaded by

manu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

Win 32 Console: How To Compile Code in Visual C++ 2005 Express Edition

To compile C code in Visual C++ 2005 Express Edition: 1. Create a new C project and solution; 2. Add and rename the main C file; 3. Press F7 to compile, resolving any precompiled header errors.

Uploaded by

manu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

How to compile C code in Visual C++ 2005 Express Edition

===============================================
1. Create a new project. Choose Win 32 and Win 32 Console Application.
2. Enter a name in the Name box below.
3. Now press the Next button and then the Finish button.
This will generate a file called name.cpp where name is your entered project name.
Now look to the Solution Explorer (if you can't see it, click View on the menu then
Solution Explorer), click name.cpp and press F2.
Now press backspace twice so you end up with name.c.
4. Press F7 To compile.
If you get an error that say "fatal error C1853: 'Debug\name.pch' precompiled header file
is from a previous version of the compiler,
or the precompiled header is C++ and you are using it from C (or vice versa)"
[Source: http://cplus.about.com/od/learningc/qt/compilingc.htm]
How to solve fatal error C1853:
=========================

1. Right-click on your C file in Solution Explorer panel, and go to Properties dialog.


Then change the value of C/C++ -> Precompiled Header -> Create/Use Precompiled
Header field to "Not Using Precompiled Header".
OR,
1. Otherwise, remove the C file from project, change the extension to CPP and add it
back, keeping #include "stdafx.h" line.
OR,
1. Third way: right-click on your C file in Solution Explorer panel, and go to
Properties dialog.
Then change the value of C/C++ -> Advanced -> Compile As field to "Compile as C++
code".

[Source: Microsoft Online Community Help]


How to debug in Visual C++ 2005 Express Edition:
========================================
1. F9 to insert break points
2. F5 to start debugging
3. F10 or F11 for step forward
4. F7 to stop debugging

How to Run C source code in Visual C++ 2005 Express Edition:


==========================================
1. Ctrl+F7 or F7 to compile and linking
2. Ctrl+F5 to run or execute

How to turn on line numbers in the editor:


==================================
1. Go to: Tools -> Options -> Text Editor -> C/C++ -> General
2. Check the box "Line Numbers" -> OK

You might also like