LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-10-2003, 11:52 PM   #1
nyquilpusher
LQ Newbie
 
Registered: Jul 2003
Posts: 4

Rep: Reputation: 0
Newbie C++ Question


Hey not new to programming C++ but new to linux... I'm running mandrake 9.1 and I'm using the KDevelop software. When I make a new file (testing.cpp), enter something simple like:

#include <iostream>

int main()

{
cout << "Linux is cool!";
return 0;
}

It says:

gmake[2]: Entering directory '/home/nyquilpusher/testing/testing' c++ -DHAVE_CONFIG_H -I, -I, -I,, -I/usr/lib/qt3/include -I/usr/X11R6/include -DQT_THREAD_SUPPORT - D_REENTRANT - O2 -O0 -g3 -Wall -fno-exceptions - fno-check-new -c testingdoc.cpp

testingdoc.cpp:27:15: x.h: No such file or directory

gmake[2]: Leaving directory '/home/nyquilpusher/testing/testing'
gmake[2] *** [testingdoc.o] Error 1
gmake[1]: Leaving directory '/home/nyquilpusher/testing'
gmake[1]: *** [all-recursive] Error 1
gmake: *** [all-recursive-am] Error 2
***failed***

Can anyone shed some light on what I need to do to get this program working or any program in general? And when I hit run and assuming everything works, will the program run in the terminal or..?

Thanks for any help
 
Old 07-11-2003, 12:37 AM   #2
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
Check your makefile (whether it was hand-written or generated by KDevelop). If you look at the message gmake gives you, it says that it's trying to compile a source file called testingdoc.cpp, then it fails because it can't find the file.

I don't use KDevelop so I can't give any suggestions on how to clean it up. My guess would be that perhaps you started a project, told it the name of the source was testingdoc.cpp, and then later changed your mind, but forgot to tell KDevelop about it. Then again, KDevelop could also just be confused on its own... dunno.

As for how he program will run, yes, I would assume a new terminal will open to execute the code. You might want to add a 'cin >> dummy_char;' line so you can see the output. Again, same disclaimers about KDevelop...

EDIT: Err... I had the whole cin command bacwards originally... oops.

Last edited by Dark_Helmet; 07-11-2003 at 12:38 AM.
 
Old 07-11-2003, 01:08 AM   #3
Pres
Member
 
Registered: Jun 2002
Location: Australia
Distribution: Slack 9.1
Posts: 232

Rep: Reputation: 30
Re: Newbie C++ Question

Quote:
Originally posted by nyquilpusher

#include <iostream>

testingdoc.cpp:27:15: x.h: No such file or directory
#include <iostream.h> perhaps ?
 
Old 07-11-2003, 02:21 AM   #4
captainstorm
Member
 
Registered: Jun 2003
Location: Oricola, Italy
Distribution: RH 9, so far
Posts: 261

Rep: Reputation: 31
I agree with Dark_Helmet, though myself don't use Kdevelop either. Probabably you accidentally changed the "file name settings" somewhere. Since the system tries to find testingdoc.cpp while what you have is testing.cpp.

The easier approch: Delete the project and make a new one; put the source file in the project and then build. However, I THINK it is necessary to add "using namespace std;" under #include <iostream>, like this:
#include <iostream>
using namespace std;
....
Other wise you'll get the error like: cout: No resolved symbol.

Please have a try and put the result here.

Qu Chen
 
Old 07-11-2003, 08:04 AM   #5
TheLinuxDuck
Member
 
Registered: Sep 2002
Location: Tulsa, OK
Distribution: Slack, baby!
Posts: 349

Rep: Reputation: 33
Did anyone else notice that the line said x.h? Perhaps if the code he is trying to compile is called testing.cpp, there must be a testingdoc.cpp elsewhere that is trying to be compiled, and is failing because the X lib/include paths are not available.. that's my guess, anyway. (=
 
Old 07-11-2003, 09:14 AM   #6
nyquilpusher
LQ Newbie
 
Registered: Jul 2003
Posts: 4

Original Poster
Rep: Reputation: 0
I just probably realised it had something to do with the random "failed" messages I got on startup.. and on closer inspection when I got o KDevelop Setupd and try to find KDE-Libraries-Doc, it says to please install it. Now how would one go about installing this?

Thanks
 
Old 07-11-2003, 09:52 AM   #7
captainstorm
Member
 
Registered: Jun 2003
Location: Oricola, Italy
Distribution: RH 9, so far
Posts: 261

Rep: Reputation: 31
KDE Doc is not installed by default if you did not choose to install it for the first time. But I am suspecting whether the problem is caused by this. Since it is Doc file...

Ok, let's take a look. I am wondering if you have indeed installation problem with Kdevelop. Please compile under shell mode.
$:g++ -o testing testing.cpp
and see whether you can compile it. If so, I suggest reinstall the Kdevelop.

Last words: please bare in mind you might have to add "using namespace std" right after the #include macro.
 
Old 07-11-2003, 09:59 AM   #8
nyquilpusher
LQ Newbie
 
Registered: Jul 2003
Posts: 4

Original Poster
Rep: Reputation: 0
And how would one go about reinstalling KDevelop? It just came on my mandrake 9.1 Cd..
 
Old 07-14-2003, 01:22 AM   #9
vapor
Member
 
Registered: Jul 2003
Distribution: SuSe
Posts: 38

Rep: Reputation: 15
include <iostream>

wtf i think u might wanna try

include <iostream.h>
 
Old 07-14-2003, 02:02 AM   #10
coolman0stress
Member
 
Registered: Jun 2003
Location: Toronto, Ontario, Canada
Posts: 288

Rep: Reputation: 30
#include <iostream>
using namespace std;

is the current proper way...

but i doubt that's the problem
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Very Newbie Question. Please Help imfineru Linux - Newbie 8 08-20-2005 05:09 AM
Apache newbie question.. (very newbie question) tarballed Linux - Newbie 1 02-07-2003 08:41 PM
RE: Suse 8.0 hardware question {newbie question, pls help} Radiouk Linux - Distributions 2 06-04-2002 12:53 PM
RE: Samba question pls help {Newbie question} Radiouk Linux - Networking 4 06-03-2002 06:40 PM
Security question {newbie question} Radio Linux - Security 3 05-17-2002 06:32 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration