Sign in to follow this  
Jake939

can't figure out visual studio c++

Recommended Posts

I've recently decided to learn c++ to make games and i have a tiny bit of programming knowlege(i used to mess around with a program called game maker). at first i used the devc++ or whatever its called. but then through reading on this website i found that visual studio c++ express was a good choice so i downloaded that. But i cannot figure out how to compile stuff with it. Could anyone help me out?

Share this post


Link to post
Share on other sites
Well, you've gotta first make a project. An empty one under General will do fine. Then make a new source file, and type in your code. Press the green arrow at the top, and it should compile.

Unless you have errors in your code of course.

Share this post


Link to post
Share on other sites
How to use Microsoft Visual C++ 2008 Express Edition:

1) Go to "File->New Project..."
2) Under the "Project Types", select "Visual C++", then "Win32".
3) On the right pane, select "Win32 Console Application".
4) Type the name of the project in the field labeled "Name".
5) Make a note of where the project will be created (the text field labeled "Location").
6) Click OK.
7) On the new dialog that appears, click "Next".
8) Click the "Empty Project" checkbox.
9) Click Finish.
10) Go to "Project->Add new Item..."
11) On the new dialog that appears, select "Visual C++", then "Code" on the left pane.
12) Select "C++ File (.cpp)" on the right pane.
13) Enter a name for the source file in the text field labeled "Name".
14) Click "Add".

*Originally posted here.

Share this post


Link to post
Share on other sites
Quote:
Original post by _fastcall
How to use Microsoft Visual C++ 2008 Express Edition:

1) Go to "File->New Project..."
2) Under the "Project Types", select "Visual C++", then "Win32".
3) On the right pane, select "Win32 Console Application".
4) Type the name of the project in the field labeled "Name".
5) Make a note of where the project will be created (the text field labeled "Location").
6) Click OK.
7) On the new dialog that appears, click "Next".
8) Click the "Empty Project" checkbox.
9) Click Finish.
10) Go to "Project->Add new Item..."
11) On the new dialog that appears, select "Visual C++", then "Code" on the left pane.
12) Select "C++ File (.cpp)" on the right pane.
13) Enter a name for the source file in the text field labeled "Name".
14) Click "Add".

*Originally posted here.



Yeah if that's not easy enough for you, Microsoft actually provides a video on creating your first console app with C++ express at the very same spot where you can download it for free.

Share this post


Link to post
Share on other sites
it says that the project is out of date and there were build errors. im not sure what that means but im almost positive im not typing the code wrong.

Share this post


Link to post
Share on other sites
Quote:
Original post by Jake939
it says that the project is out of date and there were build errors. im not sure what that means but im almost positive im not typing the code wrong.


Maybe clean and rebuild?

Share this post


Link to post
Share on other sites
If you make a change to the code and don't rebuild it (from the Build menu) then your project will be out of date, i.e. the changes you've made haven't been compiled yet. If you then try and start the program (from the Debug menu, or using the 'play' icon on the toolbar) then MSVC will tell you your project is out of date and offer to rebuild it for you.

If there are problems of any sort then you'll get errors, if you tell us what these were and perhaps show us the code the errors refer to (if they refer to code at all) then we can probably help. You can click on the Error List, or Output, tabs right at the bottom to see what the problems were.

Share this post


Link to post
Share on other sites
There should be windows labelled "Output" and "Error List". If you don't see "Output" then press Alt-2. If you don't see "Error List" press Ctrl-\ followed by Ctrl-E. Both windows will show you what the build errors are. The "Output" window will be more verbose.

Share this post


Link to post
Share on other sites
ok i figured out the problems but now when it runs it just opens the command prompt and then closes. its supposed to display some message. would it help if i put the code that im using up here?

Share this post


Link to post
Share on other sites
There are a few ways to address the immediately closing window issue. I prefer just putting a breakpoint on the last closing brace in main(). Just click in the margin immediately to the left of the line to put a breakpoint on that line.

Share this post


Link to post
Share on other sites
You might be interested in watching the video's on my website as well. They will guide you through step by step on how to make a game using visual studio.

Share this post


Link to post
Share on other sites
Another way to address the vanishing window problem, and the way I prefer personally, is the code-intrusive approach:

#include <iostream> // for std::cin

int main()
{
/*
program code here
*/


// keep window open until user presses a key
std::cin.sync();
std::cin.ignore();
}


I actually have a mini library of utility functions for doing console I/O. So, I have the above two function calls wrapped up into a prompt function:

#include "console.hpp" // for console i/o

int main()
{
/*
program code here
*/


console::prompt(); // alternatively: console::prompt("Press any key to exit.");
}


Different approaches have various upsides and downsides though.

Share this post


Link to post
Share on other sites
Quote:
Original post by mmakrzem
You might be interested in watching the video's on my website as well. They will guide you through step by step on how to make a game using visual studio.

Yes, if the OP had watched the video he could've answered all his own questions.
At least the Microsoft Intro video I referred to does a pretty good job of covering the basics!

Share this post


Link to post
Share on other sites

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