Compiling C code in Visual Studio ----URGENT

Started by
0 comments, last by nobodynews 16 years, 6 months ago
Hi, I am having the C source code with me. I would like to compile it in Visual Studio 2005. Do i need to include all the header files? I would also like to know whether i need to make changes to the Source Code. How can i compile the Source Code in Visual Studio.Please explain it clearly as i am new to Visual Studio. Thanks, Poornima.
Advertisement
Quote:Original post by poorni123
Hi,

I am having the C source code with me. I would like to compile it in Visual Studio 2005. Do i need to include all the header files?

I would also like to know whether i need to make changes to the Source Code.

How can i compile the Source Code in Visual Studio.Please explain it clearly as i am new to Visual Studio.

Thanks,
Poornima.


Which C source code? Did you write it yourself? Did someone you know give it to you? Did you find it in a book or on the internet?

What do you mean by 'include all the header files'? What do you consider 'all the header files'? Include how? In the source code or in the project setting?

Why would you need to change the source code? Why did you get it if you don't even know if you need to change it?

Anyway, here's the steps to compile and run this program:
#include <iostream>int main(){  std::cout << "Hello world!";}


1)Open Visual Studio.
2)From the "start" page select "create: project"
3)Select "Visual C++" then select "Win32" then select "Win32 Console Application"
4)In the "Enter Name" text box enter "HelloWorld"
5)Ensure "create directory for solution" check box is not checked.
6)Click "OK"
7)In the "Win32 Application Wizard" click "Application Settings"
8)Select "Empty Application"
9)Click "Finish"
10)In the "Solution Explorer" right click "Source Files" and select "add -> new item"
11)Select "Visual C++" then select "Code" then select "C++ File(.cpp)
12)In the "name" text box enter "HelloWorld"
13)Click "OK"
14)Copy and paste or type in the "Hello World" code in the source box window above this list of steps into the window
15)Press F7 to compile
16)Press Control+F5 to run the program

Now that you have the bare minimum of understanding on how to compile a file in Visual C++, read this or this book. Or buy a book or find a tutorial on the internet.

Hope that helps.

C++: A Dialog | C++0x Features: Part1 (lambdas, auto, static_assert) , Part 2 (rvalue references) , Part 3 (decltype) | Write Games | Fix Your Timestep!

This topic is closed to new replies.

Advertisement