🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.linux.development.apps
Article #109

Re: Compiling???

#109
From: Peter Samuelson
Date: Fri, 02 Apr 1999 00:00
50 lines
2517 bytes
[Ivan Van den Bossche <ivan.vandenbossche@planetinternet.be>]
> I have written a simple program which displays 'hello, world' on the screen:

> #include <iostream.h>
> int main()
> {
>     cout << "Hello, world !";
>     return 0;
> }

Sure you didn't want `<< endl' in there somewhere?  (:

> I have some questions: How can I compile the test.cpp file, so I get
> an executable file ???

Use `g++'.

> I've already used gcc and g++ but I don't know what library I have to
> link with it.

For "hello world" you need libc, libstdc++ and so forth but you
shouldn't have to specify them on the command line.  To get started all
you should need is something simple like

  $ g++ -o hello hello.cpp
  $ ./hello
  Hello, world !$ 

If you use any floating point math functions you will probably need to
explicitly link the math library in, via the `-lm' flag.  That's really
the only library that usually catches people by surprise; with other
libraries you use it should be more obvious when you need them.

> I'm also interested in programming modules and X Window - applications.

> How can I compile a source file as a X Window-applications or as a module
> written with C/C++ ???

Same way you compile anything else.  The term "module" can mean a lot
of different things.  As for X programming, you need to decide on a
toolkit (or just use Xlib, but that's hardly recommended!) and what
toolkit you pick (Motif, Athena, Tk, Gtk+, etc) will greatly affect how
you write and compile stuff -- and in some cases (Qt, for example) in
what languages.

HTH.

-- 
Peter Samuelson
<sampo.creighton.edu!psamuels>
Technical Details
Message-ID: <7e2hi8$guu$1@nemesis.niar.twsu.edu>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7e05k5$7rq$1@news.planetinternet.be>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f5392,95af74d28b45ec59
X-Google-Attributes: gidf5392,public
X-Google-Thread: 10c696,95af74d28b45ec59
X-Google-Attributes: gid10c696,public
X-Google-Thread: 10c329,95af74d28b45ec59
X-Google-Attributes: gid10c329,public
X-Google-Thread: f60be,95af74d28b45ec59
X-Google-Attributes: gidf60be,public
From: peter@nemesis.niar.twsu.edu (Peter Samuelson)
Subject: Re: Compiling???
Date: 1999/04/02
Message-ID: <7e2hi8$guu$1@nemesis.niar.twsu.edu>
X-Deja-AN: 461942020
References: <7e05k5$7rq$1@news.planetinternet.be>
Organization: National Institute for Aviation Research, Wichita State University, Wichita, Kansas, USA
Reply-To: Peter Samuelson <psamuels@sampo.creighton.edu>
Newsgroups: comp.os.linux.development.apps,comp.os.linux.development.system,fido.belg.linux,it.comp.linux.development