Advertisement

Visual C++

Started by March 16, 2002 03:51 PM
39 comments, last by sanguineraven 22 years, 7 months ago
i kno this must seem really stupid but: ive been learning c++ and so far have been using the free, Dev c++. however after reading many threads about it i decided i had better get microsoft visual studio. however things have gone wrong right from the start. i tried recreating a simple program like Hello World, as New>C++ Source Code when i compiled i got 10 errors, mainly undeclared functions like cout, even tho i included the right includes. i am lost in what to do under NEW. also i heard something like auto word complete or other features, as it seems so basic when i look at it, it has less options and functions than dev c++ but i kno this isnt true, can anyone help? What about me? What about Raven?
File -> New -> Projects -> Win32 Application

then add your source files and now you''re on business.

Those features in MSVC are not accessible until you have a running workspace and project.
Advertisement
looks like he is making a console app, not a windows app

File->New->Win32 Console Application

type in project name. click next. either choose empty project or hell world.

If you choose empty project, you have to go to project->add To Project->New... and new C++ source file
yeah, at the moment im still doing console applications but i got really confused when i did win32 console, wot is difference between project and hello world? i tried the hello world thing cos i was just trying my basic program but i didnt understand it :/

What about me? What about Raven?
right ok, new>>project>>win32 console application>>hello world


  #include <iostream>int main(){	cout >> "Hello World!" >> endl;	return 0;}  


fatal error C1010: unexpected end of file while looking for precompiled header directive

What about me? What about Raven?
namespaces...

add that or use full header name

<iostream.h>
Advertisement
Shouldn't that be...

      #include <iostream>using namespace std;int main(){      cout << "Hello World!" << endl;        return (0);}  


[edited by - Brian Jones on March 17, 2002 11:06:08 AM]

[edited by - Brian Jones on March 17, 2002 11:06:55 AM]
I don't have a signature
quote: Original post by Anonymous Poster
add that or use full header name


Rubbish! iostream.h is an obsolete header. iostream is the correct standard version.
quote: Original post by Matt Calabrese
#include //and
#include // are both the same, just different syntax...

Bullshit! You quite clearly have no idea what you are talking about.
quote: Original post by sanguineraven
right ok, new>>project>>win32 console application>>hello world


    #include <iostream>int main(){	cout >> "Hello World!" >> endl;	return 0;}    


fatal error C1010: unexpected end of file while looking for precompiled header directive

What about me? What about Raven?

Alright, as far as I can see, you have two problems. One, your shift(insertion/extraction in iostream) operators are backwards.
what you should have is:
"cout << "Hello World!" << endl;"

Also, when using the newer header, you must remember that everything is part of the std namepace. So you should either put "using namespace std;" above the declaration of main, or you should use "std::cout << "Hello World!" << endl;" if you dont want to be "using namespace std;"


------------------------------
If someone asks you "A penny for your thoughts" and you put your two cents in, do you get change?
------------------------------BASIC programmers don't die, they just GOSUB and don't return.

This topic is closed to new replies.

Advertisement