could u pls give me the steps to start a new C project and how to compile it?
ayha
Main Topics
Browse All Topicshi,
Is it possible to write C language in VIsual Studio 2008 and compile it? How can I do that if possible?
ayha
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Please read the following how to:
http://msdn.microsoft.com/
1. Main menu->File->New Projects...
2. Choose Win32 Projects.
3. Choose Win32 console application and press Ok.
4. In the New Project wizard check the "Empty Project" checkbox.
5. Press Finish.
6. In the solution view - the tree with header and sources select "sources" and right mouse click will open the popup menu.
7. In the popup menu choos "New Item..."
8. In the wizard choose C++ code and in the editbox type main.c
9. You will empty main.c file added. Type int main() { return 0;}
Though evilrix is technically correct, I would advise you to follow the steps specified above by Subrat2009. Relying on file extensions isn't the most practical thing, unless you're just messing around. The steps I have to take are different than those Subrat2009 specified (though very similar), so I will show you an alternative if the above doesn't work for you (I use Visual Studio 2008 Professional Edition; the above looks like the steps for VS2008 C++ Express)
That should do it. Hope that helps,
Nate
>> Relying on file extensions isn't the most practical thing, unless you're just messing around.
It's not about practical (or messing around!)... it's about what's correct. I'd also say that having to modify compiler settings necessarily (and it is unnecessary) is more messing around than just adopting the correct naming convention!
C++ code should always stored in .cpp files and C code in .c files and all compilers (that I've used and that's quite a few), unless told otherwise, will treat them in this way and use the correct language semantics. Sure, you can force compile C++ source as C and C source as C++ using switches but you would normally only do that if you are trying to integrate existing code (and the question leads me to believe this is not the case) and need to compile it with different language semantics.
If you are writing new code you should be naming your source code files correctly and the compiler will do the right thing.
evilrix: I completely disagree. You, as an experienced C++ programmer, should know that being as explicit as possible is always the best. When you program, you want your code to portray not only meaning, but intent. This is just one more step to take that shows intent, a rather under-rated commodity in the programming world. However, you do make a valid point with the file extensions--C source code should reside in .h, .c or .cc files, while C++ code should reside in .h and .cpp files (I tend to use .hpp for C++ header files, though this is not as common as I hope it will soon become. However, this fact is just one more arugment for my case, that the line between these two languages is not distinct enough to rely on file extensions).
Author: I strongly advise you to tell the compiler you want your code to be treated as C, rather than hoping that it "just will" (what if this behaviour changes in a later release, as the C language plummets faster and faster to death?)
Steps:
1) Open Visual Studio
2) Go under File->New->Project (click on Project )
3) New Project dialog box pops up
4) Uder Projects types: choose VisualC++ ->Win32 project (Project types: locates left)
5) Under Templates (right) choose Win32 Console Application
6) Enter name for you project under Name: (it says <Enter_name> )
7) Click OK button.
8) Win32 Application Wizard dialog box appear
9) Click next button.
10) Under Application Setting check Empty project check box and click Finish button.
11) Under Solution view right click on Source Files folder choose Add->New Item...
12) AddNew Item dialog box pops up.
13) Under Categories: (right) choose Visual C++ Code
14) Under Templates: (left) choose C++ file
15) Enter file name as main.c
16) You created C file main.c. Now you need to tell compiler to compile code as C
17) Right click on the project name, choose Properties from the menu.
18) You project name Property pages dialog shows up.
19) Choose Configuration Properties -> C/C++ -> Advances. Click on Advanced. (left)
19) On the right side find Compile As. Change Compile as C++ Code (/TP) to Compile as C Code (/TC) option.
20) Click Apply button.
21) Click OK button.
Business Accounts
Answer for Membership
by: evilrixPosted on 2009-10-29 at 07:47:09ID: 25694246
Yes, just ensure your files end in .h (headers) and .c (implementation) and the compiler should compile this code as C rather than C++.