none of the guides work with visual studio C++

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

Recommended Posts

i'm completely lost. i've been reading into a lot of guides on the internet to get into C++ programming, but i can't even get "Hello world" to work because it seems Microsoft VSC++ uses all this extra crap and all the people who created the guides i'm using are using other compilers(like dev-C++). i thought VS was the best type of compiler to use though...so i have no idea what to do. i really want to get into programming but i'm not about to download 4 different compilers just so i can run the simplest program of all.

Share on other sites
When you create a project, be sure to select "Empty Project". If you're not doing that now, it will get rid of some "extra crap". Apart from that you should post your code and *exact* error messages.

MSVC compiles standard C++ well, so it should work with any good beginner guide you have.

Share on other sites
1) File->New->Project
2) Left pane - Win32, Right pane - Win32 Console Application
3) Enter a name
4) OK
5) Next
6) Application type - Console Application, Additional options - empty project (as Simian man says above)
7) Finish
8) Right click Source Files in the solution explorer and choose Add->New Item
9) Left pane - Code, Right pane - C++ File (.cpp)
10) Enter a name
11) Project->Properties
12) Expand Configuration Properties and select General
13) Right pane - change Character Set to Not Set
14) OK

The following will now compile as expected

#include <iostream>int main(int,const char**){    std::cout << "hello world" << std::endl;}

Don't forget to hit Ctrl+F5 to run though to prevent your console window from closing as soon as the program finishes.

VS probably is the best free compiler available in the world. It is just perhaps not very beginner friendly.

HTH

Share on other sites
I'm in the same boat as the original poster. After spending many hours reading up on Visual C++ and c++ in general, I'm still quite miffed at how difficult it is to get a very simple application running.

The amount of wierd stuff that you have to do just to get sample applications started defies logic. One would think that programmers would crave efficiency when working with computers, but surely the the number of proverbial hoops you need to jump through just to get a message box on the screen is unnecessary.

I say this, admittedly as a newbie from a Visual Basic background. I've been spoon fed somewhat, and now I'm trying to learn a 'real' programming language. But if it means the methods are complicated, simply for the sake of being complicated, I think I might just go mad.

I'm sure it'll all click into place soon enough, I am not giving up. But I'm still getting compile errors aplenty which make no sense to me considering I've just lifted the code from supposedly super-easy tutorial sites from the web.

Apologies for the rant.

Share on other sites
Quote:
 Original post by EasilyConfused1) File->New->Project2) Left pane - Win32, Right pane - Win32 Console Application3) Enter a name4) OK5) Next6) Application type - Console Application, Additional options - empty project (as Simian man says above)7) Finish8) Right click Source Files in the solution explorer and choose Add->New Item9) Left pane - Code, Right pane - C++ File (.cpp)10) Enter a name11) Project->Properties12) Expand Configuration Properties and select General13) Right pane - change Character Set to Not Set14) OKThe following will now compile as expected#include int main(int,const char**){ std::cout << "hello world" << std::endl;}Don't forget to hit Ctrl+F5 to run though to prevent your console window from closing as soon as the program finishes.VS probably is the best free compiler available in the world. It is just perhaps not very beginner friendly.HTH

i get a problem when trying to go to my project's properties and VS C++ has to restart. what could cause this?

Thanks.

Share on other sites
What version of VSC++ do you use ?

Share on other sites
2005. and wow, after reinstalling because of the error and trying to download the service pack 1, i get a package error. wtf. i really hate these microsoft products, i can't use any of them correctly without getting errors.

i can't even load a C# project, i get "project creation failed" with C# and Visual basic and i've reinstalled everything.

edit: i can't even open Devcpp

why can't i do anything? should i even consider programming any more? all of this is just so stressful, it's not a good time in my life for, i'm trying really hard to start programming but nothing is working for me. i love games. they're a huge part of my life. i've got no talent. i can't draw, so i can't do what i REALLY love, which is design. so i went to programming because i also love technical marvels such as physics engines, lighting, etc. but i can't do anything with games. i hate this, i really do. i want to do something with games so badly but it seems i can't do either of the interests. i'm also horrible at animations.

Share on other sites
That's sort of an odd error. What edition of VS are you using? (Express... Standard... ?)

Share on other sites
express, if it even matters anymore.

Share on other sites
It would also be interesting to know what windows you are using (version and service packs) and how it's set up. Do you have rights to install the software and use the storage/paths it wants ?

Share on other sites
if you're asking if i have a legit copy of windows, yea. it came with SP2. it's just windows xp home.

that's all the information i have on my os.

Share on other sites
Quote:
 Original post by tentaculatI'm in the same boat as the original poster. After spending many hours reading up on Visual C++ and c++ in general, I'm still quite miffed at how difficult it is to get a very simple application running.bso

Create new project -> Visual C++ -> Win32 Project -> check 'Empty Project' under additional options.

If you want to make a console project, swap Win32 project for Win32 Console Application.

That's all there is to it. True, it's more than one click, but... still not rocket science.
After that, it's just a matter of writing code. :)

Quote:
 I'm still getting compile errors aplenty which make no sense to me considering I've just lifted the code from supposedly super-easy tutorial sites from the web.

Most super-easy tutorial sites from the web suck. As you've found out, there's absolutely no guarantee their code will even compile, or that what they teach is correct. Or that the author knew more than you about C++.

You might do yourself a big favor by buying a decent book.

Quote:
 2005. and wow, after reinstalling because of the error and trying to download the service pack 1, i get a package error. wtf. i really hate these microsoft products, i can't use any of them correctly without getting errors.i can't even load a C# project, i get "project creation failed" with C# and Visual basic and i've reinstalled everything.edit: i can't even open Devcpp

Weird. But if you get it with devcpp as well (btw, don't ever actually use that piece of junk), it doesn't seem like VS itself is the problem.
Have you tried on another OS? (Maybe create a virtual machine and install Windows there, and see if VS works better there)
Is it possible that your VS download is corrupt? (Then again, I think the installer does quite a few CRC checks so that sounds unlikely)

Share on other sites
Quote:
 Original post by SomeDude49if you're asking if i have a legit copy of windows, yea. it came with SP2. it's just windows xp home.that's all the information i have on my os.

Ah, no, sorry. Doesn't matter if it's legit or not (as in if VS should work or not), was just interested in if you were using a version that the VS is supposed to work on. Windows XP Home SP2 should indeed work, according to MS.