new to c++ - need help

Hello there, iam new to C++ i just started today with it ( using Microsoft Visual C++ 2010 Express )

I've already done this:

1
2
3
4
5
6
7
8
9
#include <iostream>
using namespace std;

int main()
{
cout << "Hello World";
cin.get();
return 0;
}


of course it was a copy&paste action of me, but i learned how to save and run it :-)

now i'd love to make a program ( exe ) wich opens Editor, and writes Hello World or something like that, but i don't know how.
Can you help me out, maybe posting me a finished Source Code, so i can watch all the commands and how it's working, and i'll learn more...i'd be very very happy

Greetings
Try tutorials like http://www.cplusplus.com/doc/tutorial/ , but maybe you should pick up a good C++ introductory book instead.
About a year ago I bought "C++ Primer Plus" (5th ed.) it is an excellent book.
As i said im fresh to C++ ... jumping on the tutorial Site dosn't help me very much, i don't know where to watch to get what i want. I have a C++ Book right here but it's all so complicated yet... that's why i ask'd for the Source Code, maybe i'll learn a little from it, i guess i'll...

Greetings
Antifact,

Regarding using VC++ Express 2010, maybe the following might be helpful.

1. I don't like navigating long paths to get to files so I created a "C++ Projects" folder on my E: data drive as E:\C++ Projects. When I start a new project in VC++ Express, in text box-1, I type the name of my project like "My project". In text box-2, I change the path to E:\C++ Projects. Then I select "Empty project" and VC++ Express then creates a folder named "My project" and saves everything for that project in that folder. Of course, if you just have a C: drive (partition), then your path would be C:\C++ Projects.

2. Step 2 of starting a new project in VC++ Express is to click PROJECT > ADD NEW ITEM and click the C++ FILE (.cpp) option, and enter the name of the .cpp file in the text box. In my case I name the .cpp file as "My project.cpp".

3. Assume you pasted the "Hello World" code in the edit window and compiled it. Now to answer your question about how to make a .exe file and run it. Navigate to: E:\C++ Projects\My project\Debug and there is a "My project.exe" file there. This .exe file is created when you successfully compile your project. This is an .exe file that you can just click on and it will open the console window and display your "Hello World" message.

Best regards,
Raptor88

Last edited on
Hello Raptor,

Im glad you posted here, this really helps me alot getting started!!
But when i click "Debug" it always says "This project is out of date: My Project - Debug Win32"
When i continue, im getting always this Error...and when i want to compile, it dosn't work :-(

I did everything right, as you told me, nothing else, i've already re-installed the Program 2 times completly, but it does not help...


Screenshot: http://i55.tinypic.com/2w68fbd.jpg

Greetings


Edit:

When i want to compile "My Project.cpp" i get this Message from the "Ouput"

1>------ Build started: Project: My Project, Configuration: Debug Win32 ------
1> My Project.cpp
1>CL : fatal error C1033: cannot open program database ''
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Last edited on
Really?

I have a C++ Book right here but it's all so complicated yet... that's why i ask'd for the Source Code, maybe i'll learn a little from it


1. You can't even get your compiler to work.

2. The complexity in the book is the complexity in code. The book will atleast tell you what it means, most source codes won't.

3. Plenty of source codes use improper practices , which, if you somehow manage to learn from it, will teach you everything the wrong way.

4. After you start reading the book or tuorial, it will all begin to make sense, and by the end, you'll have gained plenty of knowledge, and it won't look (as) complex.
Antifact,

Here is a complete, step-by-step procedure. Try following it exactly.

1. Start VC++ Express 2010.
2. In the "Start Page", click "New Project".
....a) In the left window, highlight "Win32".
....b) In the right window, highlight "Win32 Console Application".
....c) In the "Name:" text box type "My Project". "My Project" will automatically
........appear in the "Solution name:" text box.
....d) Click the "Browse" button next to the "Location:" text box.
....e) Navigate to "C:\C++ Projects".
....f) Click OK. - The "Win32 Application Wizard" window opens.
3. In the "Win32 Application Wizard" window, click "Application Settings".
....a) Put a check mark next to "Empty project".
....b) Click FINISH. - The "Win32 Application Wizard" window closes and
........a blank space is seen.
4. In the menu bar, click "Project > Add New Item".
....a) The "Add New Item" window opens.
....b) In the left window pane, highlight "Visual C++".
....c) In the right window pane, highlight "C++ File(.cpp).
....d) In the "Name" text box, type the name you want for your .cpp file.
........For this test, type "My Project".
....e) The location text box should automatically be showing
........"C:\C++ Projects\My Project\My Project\"
....f) Click the "Add" button.
....g) The "Add new item" window closes and a "My Project.cpp" edit
........window will be shown in the right window pane.
5. Paste your "Hello World" code in that window.
6. Click the green "Start Debugging" arrow head icon just below the menu bar.
7. Your project should be compiled if it is error free.
....a) The black console window opens and displays your "Hello World" msg.
8. Close the black console window by a key and ENTER or just click the red X.
9. Close VSC++ Express. (or minimize it so it can't be seen)
10. In windows explorer, navigate to "C:\C++ Projects\My Project\Debug.
....a) You should see a file named "My Project.exe".
....b) Click it and your program should be run.

Don't try to use what you already have. Do EVERY step above. If necessary,
use a different project name like "Test", so you don't reuse what you already
tried. It should work.

Raptor
Last edited on
Hey Raptor

I followed your step-by-step Guide to point 6. When i click Debug, i still get this Error as you can see in the Image i posted yesterday.
Iam very confused, yesterday when i installed Visual C++ 2010 Express for the first time, it worked like a charm, and now, always getting that Error...
Looks like when i click Debug, he cannot find the exe, thats how i understand the Error.

Thank you very much for your assistance, very kind of you!! :-)
Followed your step-by-step Guide on my Laptop now, works, perfetto! :-)
Thank you!
>> Followed your step-by-step Guide on my Laptop now, works, perfetto! :-)
Thank you! <<

Welcome and glad it's working out for you. Thanks for your update.
Raptor
Topic archived. No new replies allowed.