Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 27th, 2005, 10:20 PM   #1
gebreil
Newbie
 
Join Date: May 2005
Posts: 3
Rep Power: 0 gebreil is on a distinguished road
C++ Compile

I am new to C++ and I like to study this. I purchased the last version of C++ (2005) and I downloaded Microsoft C++ visual. When I write the program examples as per C++ and I try to compile and look at the effect I don't get any thing.

Please show me the basic steps to compile and look effect of the excercise.

should I use dos or C++ visual to compile.

Help..

Thank you,
Gebreil
gebreil is offline   Reply With Quote
Old May 27th, 2005, 10:37 PM   #2
Mjordan2nd
The Supreme Ruler
 
Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6 Mjordan2nd is on a distinguished road
Visual C++ has a built in compile and execute function. I would just use those. What happens when you compile and run the code? Does the Dos window pop up and close real fast, or is there some other problem?
__________________
"Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children." - Dwight D. Eisenhower
Mjordan2nd is offline   Reply With Quote
Old May 28th, 2005, 4:12 AM   #3
Klarre
Game engine designer
 
Klarre's Avatar
 
Join Date: May 2005
Location: Sweden
Posts: 291
Rep Power: 4 Klarre is on a distinguished road
If you are new at C++ I should recommend you to use Dev-C++ (http://www.bloodshed.net/devcpp.html) instead of the much more complex Visual C++.

To create an application in Visual C++, you first have to create a C++ project.
-> File -> New project
In the Visual C++ Projects folder, you should pick "Win32 Project"
Pick a name and a folder where to save your project and click "OK". Now there will pop up an "Application wizard" window, where you should click on "Application settings". Under "Additional options" select "Empty project". Also select "Console application", and click Finish. Now you have created a C++ project.
Now click the Project menu -> Add new item, and select C++-file. This one will now be added to your project. Now cut'n'paste this code below and hit the "Play" button next to the "Debug"-text.

------------------------------
#include <iostream>

int main()
{
std::cout << "It works\n";
system("pause");
return 0;
}
------------------------------

The system("pause") call makes the console window opened until you press any key. I recommend you to add this line to the program you are trying to compile.

Have a nice day

/Klarre
Klarre is offline   Reply With Quote
Old May 29th, 2005, 1:04 AM   #4
gebreil
Newbie
 
Join Date: May 2005
Posts: 3
Rep Power: 0 gebreil is on a distinguished road
thank you and where I can locate the execute function in Visual C++
gebreil is offline   Reply With Quote
Old May 29th, 2005, 5:35 AM   #5
Nuticulus
Programmer
 
Nuticulus's Avatar
 
Join Date: May 2005
Location: England
Posts: 61
Rep Power: 4 Nuticulus is on a distinguished road
Press F7, I believe. Or alt+F7 if you want to run it in non-debug mode.
Nuticulus is offline   Reply With Quote
Old May 29th, 2005, 12:42 PM   #6
gebreil
Newbie
 
Join Date: May 2005
Posts: 3
Rep Power: 0 gebreil is on a distinguished road
how to run a compiled program that done via MS Visual C++. what command should I enter at .the MS-DOS window or there is another way
gebreil is offline   Reply With Quote
Old May 29th, 2005, 1:30 PM   #7
Klarre
Game engine designer
 
Klarre's Avatar
 
Join Date: May 2005
Location: Sweden
Posts: 291
Rep Power: 4 Klarre is on a distinguished road
What is the problem? Double click the .exe file as you usually do with your other programs.
* If you take a look in the project folder you created when setting up the project, there will be a Debug-folder. In there you will find your .exe file.
* Another way is to dir to your project folder via a console window and type the name of the .exe file, in the Debug folder.
* The most simple approach is to click Debug-menu -> Start, in Visual C++. Or press F5.

Did I got your question?

/Klarre
Klarre is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:00 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC