Stop Microsoft
Miscellaneous => Programming & Networking => Topic started by: Siplus on 3 August 2003, 03:19
-
i finally got Kdevelop downloaded and installed, but it doesn't recognise C++ headerfiles like iostream
is iostream just a windows header file, or if it is a universal c++ header, how do i get it and install it so Kdevelop recognises it?
right now i'm stuck with stdlib.h, and the only thing i really know is printf() ....
-
I would nto recomend kdevolp. i wanted to use it when i first started c++ cause we use visual c++ crap at skool and i wanted it to look similar and such. I never figured out howto get it to work so i just said fuck it and started usin g++. g++ has worked like a charm for me.
-
With the added advantage that using a plain vanilla text editor like emacs will *force* you to learn exactly what code does what.
-
hmm, well i did try programming w/ vi as a text editor first, but when i tried compiling, it still didn't recognise the iostream header file. (i also don't know how to run the program, i successfully compiled plain C programs (a basic printf("hi") ;)
-
So gcc cli compile doesn't work?
So this isn't just a kdevelop problem?
Have you put the brackets around iostream:
include <iostream>
?
I'm not a fan of C++ as yet so I don't claim expert advice here, but I think the brackets are necessary (search standard locations kinda thing.) Only omit them if the file you require is in the current directory. But like I said, I'm not a C++ expert so don't quote me on this.
-
quote:
i finally got Kdevelop downloaded and installed, but it doesn't recognise C++ headerfiles like iostream
is iostream just a windows header file, or if it is a universal c++ header, how do i get it and install it so Kdevelop recognises it?
right now i'm stuck with stdlib.h, and the only thing i really know is printf() ....
If all you know is "printf()", then you are ONEHELLUVA long way from worrying about KDevelop! KDevelop is a programming aid for doing graphical apps based on the Qt/KDE libs. In order to write such programs, you will need to understand such things like classes, how inheritance works as you will be deriving daughter classes from the libs, how to code your event handlers, and how to read the source code for those classes contained in the Qt/KDE libs.
Your best bet is to get this free E-Book: Thinking in C++ (http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html). Study that well until you understand it. It's a very good reference, but you won't just breeze through it. Once that's done, next get: GCC on-line documentation (http://gcc.gnu.org/onlinedocs) to learn how to use GCC, then: Autobook (http://sources.redhat.com/autobook/autobook/autobook.html#SEC_Top) to learn about the GNU program managing utilities: automake, autoconf, libtool.
That's quite a bit of studying, and would be the minimum. You might also want to hit Amazon.com to check out some other books on Linux programming. (Beginning Linux Programming and Professional Linux Programming are very good, but neither cheap nor small.) Before attempting a graphical app, try programming some command line apps. Then you will be ready to start thinking about KDevelop. (Although I personally don't care for it all that much: I prefer FOX (http://www.fox-toolkit.org) instead.)
_______________________________________
Live Free or Die: Linux
(http://www.otakupc.com/etsig/dolphin.gif)
"There: now you'll never have to look at those dirty Windows anymore"
--Daffy Duck
[ August 13, 2003: Message edited by: jtpenrod ]
-
ok, i think you definatly misunderstood me there...
i don't do much with the <stdlib.h> header, and i only know a few functions from it. i mostly use <iostream.h>, and i'm used to cout/cin...
i'm far enough in knowing C++ that i can create and manipulate files, make games, even program in opengl. when i said all i really know is printf(), i was talking about the stdlib header, not just programming.
my problem here, is not the programming knowledge, or lack there of, it is that KDevelop and gcc does not recognise the iostream header file
(of, and i always put the header file in <>, i didn't know you could do it any other way)
-
If you're using KDevelop, then why do you need iostream.h? Here's the relevant part of the FOX include file; it's not there.
As you can see, FOX doesn't use iostream.h. Also, I grepped through: /usr/lib/qt3/include and also came up blank for iostream.h. Qt doesn't use it either, and I'm sure KDevelop doesn't, as it integrates with Qt and used the Qt libs as well.
It looks like iostream.h is useful for command line apps that interact with standard in & out. Since a graphical app won't use "cout" and "cin" anyway, it's not too useful in that case. The only difficulty with using "#include <iostream.h> that I found is that g++ bitches about "antiquated headers", however, that's just a warning and doesn't prevent a C++ program that uses it from compiling
______________________________________
Live Free or Die: Linux
(http://www.otakupc.com/etsig/dolphin.gif)
"There: now you'll never have to look at those dirty Windows anymore"
--Daffy Duck
[ August 15, 2003: Message edited by: jtpenrod ]
-
Any decent application, graphical or otherwise, will use standard io to write to the terminal, even if it's just printing a list of options in response to a --help option being passed, or printing the program's version number. And applications should write error messages to stderror.
As you can see FOX uses the C header stdio instead of iostream.
-
heh, is there any way i can force Kdevelop to use iostream.h?
it is what i'm used to, and i have an entire year of school programs that use iostream.h (from visual studios), and i don't want to have to change iostream to stdlib and all the functions that go with it...
-
quote:
heh, is there any way i can force Kdevelop to use iostream.h?
If KDevelop is anything like Glade, which I have used, then you can simply hand-hack the files KDevelop generates to add the iostream include where you want it, even if those files contain warnings that you shouldn't hand-hack them. After all, it's sometimes easier to modify Glade files that they claim you shouldn't modify if it makes programming the app easier.
_____________________________________
Live Free or Die: Linux
(http://www.otakupc.com/etsig/dolphin.gif)
"There: now you'll never have to look at those dirty Windows anymore"
--Daffy Duck
-
I'm not using KDevelop but I'm using g++ and I cant get the iostream file to work...
[ September 28, 2003: Message edited by: usr/bin/maniaman ]
-
Works fine for me.
May be a silly question, but whats your gcc version and do you have the libraries installed? Try it with a std:: in front of the cout. (so std::cout << "hello")
-
Just put
using namespace std;
after the #include.
-
The using namespace std; fixed it. Thanks. (http://smile.gif)
-
hey, i've had an similar problem (stupid of me, because I went and posted my question before reading this (http://redface.gif) ) Anyway, I was trying to use gcc to compile a hello world style c++ program and it gave me a whole ton of crap about cout and iostream and stuff like that... but then I saw this thread and noticed c++ (as a program)... "whatis" returns the same description for c++, gcc, g++ and cc and yet "gcc" could not compile my program while "c++" could. Any ideas on that? How different are these programs, anyway? Oh, and --version returns the same values for each one, and that stuff about std:: and using namespace std makes no difference for me. :confused:
-
gcc is the C compiler, g++ is the C++ compiler. Simple as that.
-
$ whatis gcc
gcc (1) - GNU project C and C++ compiler
I guess it was the "and C++" part that threw me off, eh? ;)
-
it stands for GNU Compiler Collection.
as i remember, Stallman took a while on one release of gcc (then it stood for GNU C Compiler) and so Cygnus,who wanted their bugfixes implemented asap took the initiative and forked it, releasing egcs instead (extended gnu compiler something or other) which made for a couple of incompatible GPL compilers and luckily, both parties worked it out quick smart and included the best of both in what is now the new gcc releases.
-
Well I may be a retard, but it seems to me that the problems raised in this topic should have been dealt with in the first day of learning C++ (or first month, depending how lazy you are). I'm not trying to say that I'm better than anyone else, because I myself am a rather novice programmer (it's amazing how much time I can waste looking at a screen).
You need to start from the start, basically. It appears that you're jumping in without reading through the basics.. you usually need to read to understand concepts. This isn't always the case, but it appears to be in this/these circumstance/s. Use help from others as a last resort, and you'll end up learning a lot more than with just asking people questions straight off the bat.
End of story: I'm an idiot.
-
well, if you're talking to me, I have been reading; at least, I figured the man pages and whatis entries would be accurate in this case. Along with a (completely "Windows-centered") textbook for class. The windows vs. linux part is the main thing throwing me off, I simply don't know how much is OS specific. Seems to me I'd have some trouble figuring out the problem on my own since gcc seemed to be the standard c/c++ compiler for linux (I didn't know of the program "c++") and it was having major trouble with what seemed to be a pretty standard piece of code. What basics do you think I've missed? I can see why you think I asked "straight off the bat," though, with my last post said as it was. I do try to avoid that. (http://smile.gif)
Edit: I definitely agree with what Faust says about using a "plain vanilla" editor for code. That just seems like the best way to learn, anyway.
[ September 30, 2003: Message edited by: Dirk Gently ]
-
itm