Hello,
I learned a lot of basic C++ programming through Code Blocks and I think it is a fantastic IDE. I decided to switch to VS2010 Professional for various reasons, and because I am able to get it free from Dreamspark. I had created another post a while back similar to this one about not recognizing some of the things in the project. Some people told me just to create an empty project, so I went ahead and made one just now. I just went to File>New>Project>Empty Project. Then, I wrote a really really simple program to see if it would compile. Also, I noticed that it didn't add quotations and curly braces automatically when I created the first one.

#include <iostream>
using namespace std;
int main() {

cout<<"The secret of the universe is 42."<<endl;
}

return 0;

The .cpp file was completely empty so I had to add the headers in myself. As you can see, I would expect this to bring up a simple console window, but I got some sort of an error instead. This is what it looks like:

http://i.imgur.com/dgxBC.png

I also get this error when I try opening the project, don't know if they are related:

http://i.imgur.com/i6Rn9.png

Any help would be much appreciated! Also just for reference of people helping me, I've been coding C++ for only two months, so I'm still in the level of making simple console applications, classes, composition, etc.
Thanks!
Carpetfizz

Recommended Answers

All 3 Replies

why do you have the return 0; line out of main()?

I don't understand the term "some sort of error". Post the error. Don't take a picture of it and link.

Also, I noticed that it didn't add quotations and curly braces automatically when I created the first one.

The .cpp file was completely empty so I had to add the headers in myself.

Are these problems? For most of us the IDE doesn't write the code for us. That's the programmer's job.

My first thought when I saw "...I had to add the headers in myself" was "poor baby"... ;o)
I've been adding my own headers for 30 years.

In vs2010 there is an option for pre compiled headers under console
applications, try ticking the box.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.