Sign in to follow this  

Compiling C code in Visual Studio ----URGENT

This topic is 3728 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 3728 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this