Linux + KDE2 + hello world = 8(

Linux + KDE2 + hello world = 8(

Post by Pete Goodw » Sun, 31 Dec 1899 09:00:00



I tried to use the KDE2 document to create a simple "hello world" sample on
Linux Mandrake 7.2

First problem, the file "klined.h" does not exist on my system, yet I
thought I had KDE 2.0 installed.

I found "klineedit.h" and it compiled but link with warnings about a shared
library conflict between two packages.

Running the resulting image resulted in a segmentation fault.

Trying out KDE samples on Mandrake 7.1 used to work, but not so on Mandrake
7.2

How do I find out if I have KDE 2.0 installed (everything seems to say KDE
2.0 in the about boxes)?

Is there a problem with KDE 2.0 as installed by Mandrake 7.2?

--
Pete Goodwin
---
Why don't I use Linux?
Waiting for Borland to release Delphi.

 
 
 

Linux + KDE2 + hello world = 8(

Post by Vann » Sun, 31 Dec 1899 09:00:00


<snip>
Mandrake tends to avoid installing development packages.  It will install
the libraries, but not the needed header and source files.  I'd look for a
package like kde2-devel, qt2-devel, or something similar.

 
 
 

Linux + KDE2 + hello world = 8(

Post by Pete Goodwi » Sun, 31 Dec 1899 09:00:00



> Mandrake tends to avoid installing development packages.  It will install
> the libraries, but not the needed header and source files.  I'd look for a
> package like kde2-devel, qt2-devel, or something similar.

Got it!

The documentation and Mandrake don't match!

Here's what got it all working:

#
#       Linux Mandrake 7.2 settings
#

QTDIR = /usr/lib/qt2
KDEDIR = /usr

QTINC = -I$(QTDIR)/include
KDEINC = -I$(KDEDIR)/include
QTLIB = -L$(QTDIR)/lib
KDELIB = -L$(KDEDIR)/lib
QTBIN = $(QTDIR)/bin

Also, the library is -lqt2, not -lqt

Once I used the above, everything worked fine.

--
Pete, running KDE2 on Linux Mandrake 7.2

 
 
 

Linux + KDE2 + hello world = 8(

Post by Matt Gai » Sun, 31 Dec 1899 09:00:00


*thinks* *scratches head* _Why_ would you need klined.h or klineedit.h when
programming something like "Hello World"?  It's a fairly simple programming
101 bit of knowledge.  C = gcc and stdio.h, and c++ = g++ and iostream.h .  
Or are you just proving to the rest of COLA your lack of programming skills
too, Claire? :P


> Damm. That's the only C program I know and even "I" could make it work
> under Borland's Turbo-C and later Turbo C++.

> Looks like you better read the "Where are my Libraries"
> How-to :)

> claire

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----
 
 
 

Linux + KDE2 + hello world = 8(

Post by The Ghost In The Machi » Sun, 31 Dec 1899 09:00:00


In comp.os.linux.advocacy, Matt Gaia

 wrote
on Mon, 20 Nov 2000 20:02:03 -0500

Quote:>*thinks* *scratches head* _Why_ would you need klined.h or klineedit.h when
>programming something like "Hello World"?  It's a fairly simple programming
>101 bit of knowledge.  C = gcc and stdio.h, and c++ = g++ and iostream.h .  
>Or are you just proving to the rest of COLA your lack of programming skills
>too, Claire? :P

You're right.

MOV  #HELLO,DX (or LEA HELLO,DX)
MOV  #9,AH
INT  21H
MOV  #0,AL
INT  20H
HELLO: .DB 'Hello, world!',13,10,'$'

:-)

(with my luck I committed half a dozen errors, though.  It's been
a very long time since I've done Intel MASM-style assembly.)


>> Damm. That's the only C program I know and even "I" could make it work
>> under Borland's Turbo-C and later Turbo C++.

>> Looks like you better read the "Where are my Libraries"
>> How-to :)

>> claire

>-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
>http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
>-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----

--

 
 
 

Linux + KDE2 + hello world = 8(

Post by Pete Goodwi » Sun, 31 Dec 1899 09:00:00



Quote:> You're right.

> MOV  #HELLO,DX (or LEA HELLO,DX)
> MOV  #9,AH
> INT  21H
> MOV  #0,AL
> INT  20H
> HELLO: .DB 'Hello, world!',13,10,'$'

> :-)

> (with my luck I committed half a dozen errors, though.  It's been
> a very long time since I've done Intel MASM-style assembly.)

Now, how do you do "hello world" in WIN32, or X, or KDE2?

That's what I was writing about in my original post.

--
Pete, running KDE2 on Linux Mandrake 7.2

 
 
 

Linux + KDE2 + hello world = 8(

Post by Mike » Sun, 31 Dec 1899 09:00:00



Quote:> Damm. That's the only C program I know and even "I" could make it work
> under Borland's Turbo-C and later Turbo C++.

> Looks like you better read the "Where are my Libraries"
> How-to :)

> claire

Programming "Hello World" in a GUI is much different that programming it for
the command line.

A typical GUI implementation has to manage windows and user input, in
addition to displaying the text. It doesn't seem like it should be that
difficult, but it generally involves creating a window, getting a pen,
associating a font and color with the pen, positioning it in the window,
writing the text, adding an "OK" button, defining an action to go with the
button (close the window), placing the button in the window, displaying the
window, and releasing the window and other objects that were created. I'm
probably leaving out a bunch of steps here, and the number and complexity of
the steps depends strongly on the particular GUI you're writing for. My
point is just that it's much more complex than it first appears, even to
write a simple "Hello World," application.

-- Mike --

 
 
 

Linux + KDE2 + hello world = 8(

Post by Matthias Wark » Sun, 31 Dec 1899 09:00:00


It was the Wed, 22 Nov 2000 15:23:55 GMT...


> A typical GUI implementation has to manage windows and user input, in
> addition to displaying the text. It doesn't seem like it should be that
> difficult, but it generally involves creating a window, getting a pen,
> associating a font and color with the pen, positioning it in the window,
> writing the text, adding an "OK" button, defining an action to go with the
> button (close the window), placing the button in the window, displaying the
> window, and releasing the window and other objects that were created. I'm
> probably leaving out a bunch of steps here, and the number and complexity of
> the steps depends strongly on the particular GUI you're writing for. My
> point is just that it's much more complex than it first appears, even to
> write a simple "Hello World," application.

Not necessarily.

/* gnomish-hello.c -- (C) 2000 Matthias Warkus */

#include <gnome.h>

int main(int argc, char **argv)
{
        GtkWidget *ok;

        gnome_init("Gnomish Hello", "0.0", argc, argv);
        ok = gnome_ok_dialog("hello, world");

        gtk_main();
        return 0;

Quote:}

That's the most minimal version I could think of. Note that it hasn't
got any events hooked up, so clicking the OK button will close the
window yet leave the application running.

mawa
--
Dinner is ready when the smoke alarm goes off.

 
 
 

Linux + KDE2 + hello world = 8(

Post by The Ghost In The Machi » Sun, 31 Dec 1899 09:00:00


In comp.os.linux.advocacy, Pete Goodwin

 wrote
on Tue, 21 Nov 2000 21:25:36 +0000


>> You're right.

>> MOV  #HELLO,DX (or LEA HELLO,DX)
>> MOV  #9,AH
>> INT  21H
>> MOV  #0,AL
>> INT  20H
>> HELLO: .DB 'Hello, world!',13,10,'$'

>> :-)

>> (with my luck I committed half a dozen errors, though.  It's been
>> a very long time since I've done Intel MASM-style assembly.)

>Now, how do you do "hello world" in WIN32, or X, or KDE2?

The X "hello world" takes about 50 lines or so.
The Win32 "hello world" takes even more.

KDE2 doesn't do "hello world"; that's a function of its underlying
widget set, Qt.

Quote:

>That's what I was writing about in my original post.

>--
>Pete, running KDE2 on Linux Mandrake 7.2

--

 
 
 

Linux + KDE2 + hello world = 8(

Post by Ketil Z Mald » Sun, 31 Dec 1899 09:00:00



>> the steps depends strongly on the particular GUI you're writing
>> for. My point is just that it's much more complex than it first
>> appears, even to write a simple "Hello World," application.
> Not necessarily.

[14 lines, ~230 characters]

Quote:> That's the most minimal version I could think of.

As compared to

        #!/bin/sh
        echo "hello world"

(45 chars) or for C,

        main(){
            puts("hello world");
        }

(59 chars). Haskell:

        main = putStr "hello world"

(35 chars).

Of course, with MS Visual Developer Studio, you can write a hello
world application by selecting it in a few dialogs.  The resulting
program is large, though, but it's a minimum of key presses, I'm
sure.

(On the other hand, I'm not sure what I'm trying to prove :-)

-kzm
--
If I haven't seen further, it is by standing in the footprints of giants

 
 
 

Linux + KDE2 + hello world = 8(

Post by Matthias Wark » Sun, 31 Dec 1899 09:00:00


It was the Thu, 23 Nov 2000 08:54:12 GMT...


> >> the steps depends strongly on the particular GUI you're writing
> >> for. My point is just that it's much more complex than it first
> >> appears, even to write a simple "Hello World," application.

> > Not necessarily.

> [14 lines, ~230 characters]

> > That's the most minimal version I could think of.

Hm... This works, too:

#include <gnome.h>
main(int argc, char **argv)
{
        gnome_init("hello", "0.0", argc, argv);
        gnome_ok_dialog("hello, world");
        gtk_main();
        return 0;

Quote:}

mawa
--
Wenn die Wochentage L?nder w?ren...
...dann w?re der Mittwoch Vietnam.
 
 
 

Linux + KDE2 + hello world = 8(

Post by The Ghost In The Machi » Sun, 31 Dec 1899 09:00:00


In comp.os.linux.advocacy, The Ghost In The Machine

 wrote
on Wed, 22 Nov 2000 23:03:51 GMT

>In comp.os.linux.advocacy, Pete Goodwin

> wrote
>on Tue, 21 Nov 2000 21:25:36 +0000


[snip]

Quote:>>Now, how do you do "hello world" in WIN32, or X, or KDE2?

>The X "hello world" takes about 50 lines or so.

Update: I've just looked at a rather simple implementation (my own)
of "hello world" using raw X windows (no widgets).  It takes 80
lines, or 1,540 characters -- and that's without comments.
It draws two windows (one inside the other) with the text more
or less in the center of the secondwindow, and does almost
everything properly.  At least, I think it does... :-)

Quote:>The Win32 "hello world" takes even more.

136 lines for the .cpp file, 7 lines for an include file,
and 80 lines for the .rc file, for a grand total of 223 lines.
Note that the .h and the .rc file are auto-generated by
Borland.  And this isn't even quite the correct solution,
as it simply draws an 'X', instead of printing "hello world"
(although a one-line substitution would take care of that, I think).
10 of those lines are comments; 17 of these lines are dedicated
to class registration (which must be done prior to opening
a window, if it's not one of the "standard" window types, I guess).
It also doesn't open a second window within the first.
(I don't remember if Windows can support that or not; X can
implement an arbitrary tree of windows.)

Note that there's more up-to-date technology available, as
well; I don't know if VC++ would use so many lines, for example.
(Of course, it might cheat and use additional DLL calls, too. :-) )

Another update: the GTK tutorial has a "hello, world"-type program
that has 98 lines, but has a lot of comments explaining things
and some extra glop regarding delete events and button pressings
(the "hello world" is in fact a pressable button).

[snip]

--

                    up 74 days, 2:49, running Linux.

 
 
 

Linux + KDE2 + hello world = 8(

Post by Pete Goodwi » Sun, 31 Dec 1899 09:00:00



Now do it in Delphi on Windows.

Number of lines of code - none. It's all done in the resource editor. You
create an application with a single form, set its title to "Hello World".
Compile/Link/Run faster than GNU C/C++ can do it for a similar X
application and there you are.

I'm learning Qt and KDE on Linux. A few lines of code, I suspect.

--
Pete, running KDE2 on Linux Mandrake 7.2

 
 
 

1. erroneous "hello" from forked "hello world" process!


fork() and wait() are not part of the C language, so this belongs in
comp.unix.programmer.  I have redirected followups.  (Old-timers may
note that I try to be impartial about all misdirected stuff, not just
MS-DOS stuff).

His TA expects

to produce

but instead it produces one of `Hello\nHello\nWorld' or `Hello\nWorld\nHello'.

Your TA should; he or she should certainly know about the boundaries
between `things in the operating system' and `things not in the
operating system' in order to work with an OS class in the first place.
printf() is part of the C runtime system, *not* the Unix OS; fork()
and wait() are part of the Unix OS, not the C runtime system.  Thus
there is no guarantee about the way the two interact.

In particular, when printing to a `buffered' file the runtime system
buffers (hence the name) the text until it has a `suitable amount' to
write at once.  It then sends it all out with one or more write() system
calls.  Since fork() simply duplicates all the data in the program, it
duplicates any buffered text.  Thus the program above becomes one
process with `Hello\n' buffered, and one with `Hello\nWorld\n' buffered.

The real oddity is not that the word `Hello' is ever duplicated, but
rather that it is sometimes *not* duplicated.  This happens whenever
the string `Hello\n' is written out before the program forks, which
includes whenever the standard output is line buffered or unbuffered.
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 405 2750)

2. termination by signals & _exit()

3. writing hello world in linux

4. CERT and IPSEC and SSH

5. Hello world module won't work on my linux

6. Xserver mouse error

7. "Hello,Hello,Hello-Whats going on here then?"

8. Build you own mozilla

9. ??: Linux 'cpp' Setup - Linker Error Generated on Hello World?

10. hello world: looking for linux contributors

11. "Hello World!" = "HellWrld" on Solaris 8, Linux ok

12. Help. My first .c program (hello world)

13. hello world