Jump to content

Can't run c++ programs in kdevelop


Recommended Posts

Hi,

 

 

I am using Fedora core 5 32 bit Linux. I am using the Kdevelop IDE/interface to run my first C++ program. Being new to the IDE, all I do first, is click on the Project menu and then select New Project. Then click on the All Projects tab. This shows two options C and C++. So I select C++ and it expands giving more options underneath it such as CMake Based Project, Embedded, GTK, KDE, Kdevelop, QMake Project, wxWidgets. I select the QMake Project option and it expands giving some more options underneath such as Simple ClanLib Application, Simple Hello World Program, Simple ncurses Hello World Program etc. I chose "Simple Hello World Program". Then I give an application name like "first" and location of the file. As soon as I do this, a new program called main.cpp is automatically written by Kdevelop and when I try to execute it, a dialog box cames with a message saying "There is no Makefile in this directory and no configure script for this project. Run automake and friends and configure first?" I click on "Run them" and a new windows opens with an output of the main.cpp file with the following message:

 

Hello World.

Press enter to continue...

 

I do so and close down the Kdevelop ide. Then I restart the IDE and click on File menu and chose New and creat a new file with a name "two" and added the following code into it.

 

 

#include <iostream>	 

using namespace std; 

int main()							// Most important part of the program! 
{ 
 int age;							// Need a variable... 

 cout<<"Please input your age: ";	// Asks for age 
 cin>> age;						  // The input is put in age 
 cin.ignore();					   // Throw away enter 
 if ( age < 100 ) {				  // If the age is less than 100 
 cout<<"You are pretty young!\n"; // Just to show you it works... 
 } 
 else if ( age == 100 ) {			// I use else just to show an example  
 cout<<"You are old\n";		   // Just to show you it works... 
 } 
 else { 
cout<<"You are really old\n";	 // Executed if no other statement is 
 } 
 cin.get(); 
}

 

 

Save it and click on "Execute program" button, the gearlike symbol, but to my surprise it does not give me the output it should have instead gives me the output of the previous main.cpp file as follows:

 

Hello World.

Press enter to continue...

 

Now can any one please tell me what to do? How can I make new files in this same project and execute them properly. This is driving me nuts, can't understand what is going wrong here. Thanks.

Edited by tech291083
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...