Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C++ (http://www.programmingforums.org/forum15.html)
-   -   C++ Compile (http://www.programmingforums.org/showthread.php?t=4141)

gebreil May 27th, 2005 10:20 PM

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

Mjordan2nd May 27th, 2005 10:37 PM

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?

Klarre May 28th, 2005 4:12 AM

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

gebreil May 29th, 2005 1:04 AM

thank you and where I can locate the execute function in Visual C++

Nuticulus May 29th, 2005 5:35 AM

Press F7, I believe. Or alt+F7 if you want to run it in non-debug mode.

gebreil May 29th, 2005 12:42 PM

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

Klarre May 29th, 2005 1:30 PM

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


All times are GMT -5. The time now is 11:22 AM.

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