Why Visual C++ ?

Started by
20 comments, last by MaulingMonkey 16 years, 11 months ago
Quote:Original post by Spoonbender
What about Visual Studio is it that seems too complex?
I find it pretty easy to use (you don't have to use every feature it offers, after all), but maybe I'm just too used to the program to see what it is that's confusing you.

You create a project, you add your files to it, you hit F5 to compile and run. That's about all I can think of that you need to know to use it.


It's complex because I don't know how to use it. Here's the problem I'm having, I make a new Project, name it, then I make a new file, I then write the code and press F5, and it says it can not find the file. What am I doing wrong?
Advertisement
Some basic tips:
* A Solution is a collection of releated Projects
* A Project is (usually) a program, or a dll.

For a game, you might have one project for your game, and one project for your editor if you have one. Perhaps you have a dll with your engine and/or things that are shared between the game and the editor.

When you create a project in Visual C++, make sure you check the empty project checkbox, and until you know what you are doing, stay away from all CLR projects (use Win32 Console Application if you are developing a console application). Also, an empty project is not the same as a non-empty project with all files removed (those stdafx files have a special meaning, and you must change project settings if you want to remove them).

Once you have a solution and a project, make sure you add files to the project. Just creating new files with Ctrl-N does not seem to add them to the project by default in VC++ express (is this just a setting I've made somewhere?). So to add files to the project, rightclick on the project in Solution explorer (if it's not visible, you can find it in the View menu), and select Add->New Item. [edit] Changed new file to New Item. Also, if you already have a .cpp file, you can ofcourse use Add->Existing Item, to add it to the project instead, or drag it from Explorer to your project in the solution explorer.

Once you've created a project with some .cpp file, save it, and try to run it using F5 (or Ctrl-F5 if you don't want it to dissapear immediatly).

If you get errors, look at the bottom of the screen. There, you should see a list of messages, errors and/or warnings. Doubleclicking them will take you to the line with the error.

If your program crashes, run it with F5, and when it crashes, click Break, to get to the line where it crashed. Then hover your mouse over your variables to see their values, and what caused the program to crash. If the value of a pointer is 0xcccccccc (or is it 0xcdcdcdcd?) it means you forgot to initialize it. To quit the program, use Shift-F5 (stop debugging).

If your program behaves weird, and you know about where, you can go to that line and press F9, then run using F5 (you can also do this while the program is running). Your program will then stop at that line, and let you examine all variables and their values to see if anything is wrong. Use F5 to resume execution, F9 on the same line to remove the breakpoint, and F10/F11 to move to the next line.

Use F1 on anything you don't understand to get to the documentation.
Now that you can get the Express Edition of VC++ for free, I don't see why you'd want to use anything else. It's got everything you need, and I've found it a lot easier to use than Dev-C++. You do have to do a little hackery to get it to compile windows native binaries and dlls, I believe, but still, it is free now, and it has a large number of useful features.
Eric Richards
Quote:Original post by Diminished
Here's the problem I'm having, I make a new Project, name it, then I make a new file, I then write the code and press F5, and it says it can not find the file. What am I doing wrong?
Well, that could certainly be a problem. You don't want to simply "make a new file." You want to add a new file to the project.

If I recall, you right-click on your project, then there should be an option in that context menu to add a new file to the project. Simply going through the menus and selecting "File->New->C++ File" (or whatever) won't add it to the project, and it will, indeed, complain that it can't find it.

Since you've already created a file, you can right-click the project and select the option to add an existing file to the project.

Preferably, I like to use Code::Blocks. It is really simple and smaller then most other IDEs. Not to mention, I compiled the same project using the Microsoft Compiler, then with MingW compiler; I got a smaller exe size using the MingW one.
Visual C++ Express Edition here.

I have used both Code::Blocks and Dev-CPP, and I must say that Visuals way of doing stuff REALLY helps lots of time. Sure it did take me a little bit to get used to the way it does stuff, but in the end: I love it.

It's debugger has helped me out a whole lot in situations where I would have no idea where to begin while using Code::Blocks and Dev-CPP.

You said your getting errors? What kind of errors? Copy and paste the errors here, and I am sure that we can help ya.

Chad.

Quote:Original post by Daerax
Quote:Original post by MaulingMonkey
Quote:Original post by Diminished
Is there a specific reason to use Visual C++ over any other compiler?

No1.
Quote:Original post by Diminished
Is there a specific reason to use Visual C++ Studio over any other compiler IDE?

There are good ...


Your first sentence stands in contrast with the corrections you made in the text which you quoted.


This contrast was deliberate, to clarify what I was specifically refering to, as it appeared the OP had muddled the distinct terms together (which is fairly common). You can use other compilers with Visual Studio than the core one it ships with. My assertion is that sometimes using other compilers makes sense (I certainly do), but that using other IDEs never makes sense when VS is available.
Quote:Original post by DvDmanDT
Some basic tips:
* A Solution is a collection of releated Projects
* A Project is (usually) a program, or a dll.

For a game, you might have one project for your game, and one project for your editor if you have one. Perhaps you have a dll with your engine and/or things that are shared between the game and the editor.

When you create a project in Visual C++, make sure you check the empty project checkbox, and until you know what you are doing, stay away from all CLR projects (use Win32 Console Application if you are developing a console application). Also, an empty project is not the same as a non-empty project with all files removed (those stdafx files have a special meaning, and you must change project settings if you want to remove them).

Once you have a solution and a project, make sure you add files to the project. Just creating new files with Ctrl-N does not seem to add them to the project by default in VC++ express (is this just a setting I've made somewhere?). So to add files to the project, rightclick on the project in Solution explorer (if it's not visible, you can find it in the View menu), and select Add->New Item. [edit] Changed new file to New Item. Also, if you already have a .cpp file, you can ofcourse use Add->Existing Item, to add it to the project instead, or drag it from Explorer to your project in the solution explorer.

Once you've created a project with some .cpp file, save it, and try to run it using F5 (or Ctrl-F5 if you don't want it to dissapear immediatly).

If you get errors, look at the bottom of the screen. There, you should see a list of messages, errors and/or warnings. Doubleclicking them will take you to the line with the error.

If your program crashes, run it with F5, and when it crashes, click Break, to get to the line where it crashed. Then hover your mouse over your variables to see their values, and what caused the program to crash. If the value of a pointer is 0xcccccccc (or is it 0xcdcdcdcd?) it means you forgot to initialize it. To quit the program, use Shift-F5 (stop debugging).

If your program behaves weird, and you know about where, you can go to that line and press F9, then run using F5 (you can also do this while the program is running). Your program will then stop at that line, and let you examine all variables and their values to see if anything is wrong. Use F5 to resume execution, F9 on the same line to remove the breakpoint, and F10/F11 to move to the next line.

Use F1 on anything you don't understand to get to the documentation.


Thanks, this helped a lot. I should of posted here a long time ago, it would of saved me from a lot of heartache. Thanks again everyone.
Quote:Original post by MaulingMonkey
Quote:Original post by Diminished
Is there a specific reason to use Visual C++ over any other compiler?

No1.
Quote:Original post by Diminished
Is there a specific reason to use Visual C++ Studio over any other compiler IDE?

There are good reasons to use Visual C++ over any other specific IDE currently in existance. Because it's simply the best (for C++ at any rate).

...

EDIT: [1] The Visual C++ compiler is also pretty kicking and better than many in various ways, but no, sometimes using other compilers makes sense. In fact, I recommend using multiple compilers in many situations, for a variety of reasons.

I am not trying to correct you. Simply that I was confused by your post and need your help in clearing it.
Quote:
C++ is far more complicated than the Visual Studio IDE....

I am not sure what you mean by this. I am not sure their complexities are commensurable, or did you mean your average C++ command line compiler?
Quote:Original post by Daerax
Quote:
C++ is far more complicated than the Visual Studio IDE....

I am not sure what you mean by this. I am not sure their complexities are commensurable, or did you mean your average C++ command line compiler?


I think he meant, that C++ (the language itself) is far more complicated than Visual Studio IDE. Actually, I agree - you can learn how to use an IDE in a few days, and learn the rest of it when you need it. However, to learn C++... Let's just say, that it takes a lot longer than a few days to learn C++ language.

This topic is closed to new replies.

Advertisement