"Linux Gazette...making Linux just a little more fun!"


More 2¢ Tips!


Send Linux Tips and Tricks to [email protected]


New Tips:

Answers to Mail Bag Questions:


Using gmenu with fvwm2

Sun, 01 Aug 1999 16:35:00 -0500
From: Tim Moran <[email protected]>

I usually use fvwm, but sometimes I like to switch to enlightenment. The problem was maintaining two sets of menus. So, with a little tweaking, I now use the gnome menu editor to maintain both.

Enlightenment is simple. The menu.cfg can read gnome's menus with:

BEGIN_NEW_GNOME_MENU("GNOME_USER_SUBMENU", "ROOT", HOME_DIR"/.gnome/apps")
ADD_MENU_TITLE("User Apps")
END_MENU

Fvwm was a bit tricky. I probably am not using the best possible solution, but it works for me.

I recompiled wmconfig that comes with RedHat 6.0. In wmconfig.c there is a section that begins #if HAVE_GNOME. I changed this to read my ~/.gnome/apps directory:

ret = parse_gnome_files("/home/tmoran/.gnome/apps", NULL);

Then I made a little shell script to run wmconfig and clean up some unneeded files:

#!/bin/sh
wmconfig --output=fvwm2 --no-sysdir --rootmenu="ROOTMENU" > .fmenu
find /home/tmoran -name .order -exec rm -f {} \;
find /home/tmoran -name .directory -exec rm -f {} \;

Finally, my .fvwm2rc contains:

AddToMenu RootMenu	
+			"&Rxvt"		Exec exec rxvt
+			""		Nop
Read /home/tmoran/.fmenu
AddToMenu RootMenu	
+			""		Nop
+			"&Fvwm Modules"	          Popup Module-Popup
+			""		Nop
+                       "Refresh Screen"   Refresh
+			""		Nop
+			"&Exit Fvwm"	Popup Quit-Verify


Iomega ATAPI Zip Drive That Cables Up to IDE & Red Hat 6.0

Tue, 17 Aug 1999 11:15:40 -0700
From: rbsimon <[email protected]>

A simple way to mount your ATAPI Zip drive is to:

  1. Create a mount point, e.g. /mnt/zip
  2. Install loadable kernel module: 'insmod ide-scsi'
  3. Mount the device: 'mount -t msdos /dev/sda4 /mnt/zip'
  4. To unmount: 'umount /dev/sda4'


A 2c Tip - Funny signature

Wed, 18 Aug 1999 20:58:49 +0200
From: Csaba Feher <[email protected]>

Hello guys,

I just make up my mind to write a short shell-script to do some fun. It is for making funny signatures with 'fortune'. You can use it with your mailing software that can handle signatures. I tested it with Netscape and Pine, with a Mandrake Linux distro.

You need:

  1. the 'fortune' application. I think many of you have it under /usr/games/ (Or somewhere else, so you may edit the script if you need to.) If not, your installation media or a close FTP mirror should have it.
  2. an 'sh' compatible shell...
  3. the script below. I call it 'sigchange'.
  4. a .signature file in your home directory (optional)
#!/bin/sh
#
# sigchange
#
# A simple shell script to get your .signature file looking more funny....  
#
# Written by Csaba Feher ([email protected])
#

# First, if .signature exists, we just remove it, in order to start with an empty one if [ -f $HOME/.signature ]; then rm -f $HOME/.signature fi

#Then, make some good-sounding signature with the help of 'fortune'. #The -s option is because of Netscape, it says that the estimated length of the signature was 4 lines. #You may alter the categories to suit your needs. I prefer these two... /usr/games/fortune -s linuxcookie computers > $HOME/.signature S=$(cat $HOME/.signature)

#Take a short look at your basic signature file, #which you may want to appear at the end of all newly-made signature. #Create & edit as you like. But, I suggest to keep it short. O=$(cat $HOME/.signature.basic)

#Now put the whole stuff to the usual place echo -e "$S\n $O" > $HOME/.signature

Usage:

  1. Use the script and make it executable for everybody you want to be able to use.
  2. Copy it under /bin or /usr/bin, or wherever you want to. Do not forget to check your PATH variable, it should include the path to 'sigchange'.
  3. Add the following line to your system initialization script:
    sigchange
    
    This is /etc/rc.d/rc.sysinit for Mandrake or Red Hat; it may be different in other distributions. You should check and find the script that initializes and boots up your system. The .signature will change each time you reboot your Linux box.
  4. If you prefer more changes, you can add a line containing this:
    sigchange
    
    to /etc/rc.d/rc (Mandrake/Red Hat). It starts 'sigchange' each time the runlevel changes.
  5. make a .signature.basic file in your home directory, or rename your existing .signature file to it. Edit it to contain a suitable signature you want to use at the bottom of your mails. I think you should keep it short.

Changes are made at the next reboot /runlevel change.

Feel free to use and enjoy it! Any comments are welcome!

p.s.: my recent signature is made with this method...

--
But what can you do with it? -- ubiquitous cry from Linux-user partner.
(Submitted by Andy Pearce, [email protected])

### Keep on running LINUX! # Csaba Feher # [email protected] ###


HOWTO searching script

Wed, 25 Aug 1999 11:56:57 -0400 (EDT)
From: Matt Willis <[email protected]>

I find that searching howtos is easier if you use a script. I was inspired by another program to write a semi-smart howto script. You use it like:

howto lilo

and it searches for lilo, Lilo, LILO etc in the HOWTO tree, and then finds LILO. If something is not found, it lists suggestions.

- Matt Willis

#!/bin/csh

# HOWTO Database searcher with limited smarts

setenv HOWTOBASE /usr/doc/HOWTO
setenv HOWTOPATH `find $HOWTOBASE -type d -print`
setenv FOUND 0

setenv NAME1 $1
setenv NAMELC `echo $1 | tr 'A-Z' 'a-z'`
setenv NAMEUC `echo $1 | tr 'a-z' 'A-Z'`
setenv NAMEPC `echo $1 | awk '{print toupper(substr($1,1,1)) substr($1,2)}'`

foreach NAME ($NAME1 $NAMELC $NAMEUC $NAMEPC)
    foreach k ($HOWTOPATH)
        if (-f $k/$NAME-HOWTO) then
            echo $k/$NAME-HOWTO
            less -r $k/$NAME-HOWTO
            setenv FOUND 1; break; break
        else if (-f $k/$NAME) then
            echo $k/$NAME
            less -r $k/$NAME
            setenv FOUND 1; break; break
        else if (-f $k/$NAME-HOWTO.gz) then
            echo $k/$NAME-HOWTO.gz
            gunzip -c $k/$NAME-HOWTO.gz | less -r
            setenv FOUND 1; break; break
        else if (-f $k/$NAME.gz) then
            echo $k/$NAME.gz
            gunzip -c $k/$NAME.gz | less -r
            setenv FOUND 1; break; break
        endif
    end
end

if ($FOUND == 0) then
    echo "Was unable to find '$1' .. possible matches:"
    # use case-insensitive name search (iname)
    setenv MATCH `find $HOWTOBASE -iname ''\*$1\*'' -print`  
    if ("$MATCH" == "") then
        echo "Nothing (sorry)!"
    else
        foreach k ($MATCH)
            echo $k | sed 's/^.*\// /'
        end
    endif
endif


Tips in the following section are answers to questions printed in the Mail Bag column of previous issues.


ANSWER: Splitting big files

Wed, 04 Aug 1999 13:41:02 +0200
From: Finn Jespersen <[email protected]> Laurent Mulot ([email protected]) wrote:
I'd like to truncate a 3MB file so that I can put it on floppy disks. The file is already compressed. Is there a Linux instruction or a software that can do such a thing ?

Every Linux comes with the GNU utilities. One of these is "split" which will do the job. Read man split or info split.

To split a file into floppy sized files

 	split -b1440k a_whopping_big_file chunk

which produces chunkaaa, chunkaab, chunkaac etc.

Use mcopy to copy to/from floppy. To re-create a_whopping_big_file do

 	cat chunk* > a_whopping_big_file

Hope this helps.
Finn

Martin Benthues <[email protected]> suggests:

The required task is rather easy to be achieved if both source and target system are linux and have GNU tar installed.

Assume floppy drive is a 3.5" drive at /dev/fd0

Copy to disk:

tar -c -f /dev/fd0 -L1440K -M 

Copy from disk:

tar -x -f /dev/fd0 -L1440K -M 

tar will prompt the user to enter a new disk when ever it made one full.

Note:
The floppy disks will be overwritten without warning. Any old content is lost. No useable file system is installed. The disks are treated as a "tape" containing a set of blocks. For any later use with an operating system (DOS, Linux) the disks need to be reformatted.

Best regards,
Martin Benthues

Brian <[email protected]> says:

Short explanation: If you use the 'split' command, you can split a file up into chunks. Once onto a floppy, you can transport the file. When you want to reclaim the files, you can simply copy them back to hard drive and use 'cat' to put them back together.

Long (full) explanation: I have a 292529 byte file named lasg-0-0-9.pdf on my hard drive, and I want to save it in chunks (or less) so I can put it on floppy for saving... You can see that no chunk is larger than 1K, as specified by the -C1k option to 'split'. The second option un this example is the name of the original file, and the third option in this example is the name of the output file prefix. The prefix is followed up by a unique string which ensures that when concatenated in a sorted order that you get the same file back. I tested this with the command

cat lasg-0-0-9.pdg[a-z][a-z]* > tmp.lasg-0-0-9.pdf 
and the resulting file tmp.lasg-0-0-9.pdf was identical to the original file.
% split -C1k lasg-0-0-9.pdf lasg-0-0-9.pdf
%ls -al 
Total 655
drwxrwxr-x   2 vocalist users        9216 Aug 21 08:53 .
drwxr-xr-x  20 vocalist users        2048 Aug 21 08:50 ..
-rw-rw-r--   1 vocalist users           0 Aug 21 08:53 data
-rw-rw-r--   1 vocalist users      292529 Aug 21 08:50 lasg-0-0-9.pdf
-rw-rw-r--   1 vocalist users         898 Aug 21 08:52 lasg-0-0-9.pdfaa
-rw-rw-r--   1 vocalist users         738 Aug 21 08:52 lasg-0-0-9.pdfab
-rw-rw-r--   1 vocalist users        1024 Aug 21 08:52 lasg-0-0-9.pdfac
-rw-rw-r--   1 vocalist users        1024 Aug 21 08:52 lasg-0-0-9.pdfad
[Lots and lots of lines not shown. -Ed.]
-rw-rw-r--   1 vocalist users        1020 Aug 21 08:52 lasg-0-0-9.pdfno
-rw-rw-r--   1 vocalist users        1000 Aug 21 08:52 lasg-0-0-9.pdfnp
-rw-rw-r--   1 vocalist users         118 Aug 21 08:52 lasg-0-0-9.pdfnq

Jimmy O'Regan <[email protected]> chimes in:

You can find out more by typing "man split" or "info split".

But in your case you'd probably want to try

$ split -b 1380k your.file your.file.
So it'll split the file "your.file" into files of 1.38m in size (ideal for floppies), named your.file.aa, your.file.ab and your.file.ac (etc if you use a different size).

You can rejoin them with

$ cat your.file.aa your.file.ab your.file.ac & your.file

J.

Remco Schellekens <[email protected]> suggests:

dd will do the trick.

Use it in the form:

dd if=your-input-file of=first-out-file skip=0 count=2840
dd if=your-input-file of=second-out-file skip=2840 count=2840
dd if=your-input-file of=third-out-file skip=5680 count=2840
...and so on.

Assuming blocksizes are 512 bytes, so the count of 2840 is approx. 1.4 Mb To get the file back just use cat command:

cat first-out-file > your-file
cat second-out-file >> your-file
... and so on

of course it will be a bit easier if you make a shell script of it.

Thats it.

Roland Smith <[email protected]> also suggests:

3) Zip the file and use zipsplit to split it into files that will fit on a floppy.

Hope this helps.


ANSWER: Formating drives

Tue, 03 Aug 1999 22:43:10 +0100
From: Murray Gibbins <[email protected]>

Hi,

if e.g. your LS120 is on /dev/hdb try

mksf -t ext2 /dev/hdb

or some variant thereof.

Yours
wibble


ANSWER: Kodak Problems

Tue, 03 Aug 1999 22:48:24 +0100
From: Murray Gibbins <[email protected]>

Investigate using Perl and ImageMagick, it will automate the proccess and do everything you want.

Yours
Wibble

Zak <[email protected]> responds:

I would like to thank each and every person who responded to my question about using gimp with the subject disk. The problem was that when I put the images on the HD (using Mcopy, since the Kodak(c) Picture Disk is a DOS/'doze thingee), they were upside-down (and I later found *were* left to right), and that I couldn't figure out how gimp worked. I use RH 5.1.

One of the replies suggested I try 'xv', so I looked in my RH5.1 manual, and found on page 6 that it had been replaced. I checked out my 5.1 CD (I bought the 'official box') and guess what...it's there! I tried it and it not only flipped the images 'rightsideup', but can also flip 'em right-to-left, and much more. Now here's the kicker: about two weeks ago I put another roll of film in and requested the disk when it was processed. When I got the pix and disk back, I stuffed the disk into FRED and called up 'xv' so that I could flip the pix again.

They were all set up correctly on the disk! I didn't have to do anything with them. Do you think maybe someone from Kodak reads Linux Gazette, too?

Zak


ANSWER: Installation problems

Tue, 10 Aug 1999 17:13:27 +0200
From: Michael Planes <[email protected]>

Hi, I hope you already had an answer from the net. Otherwise, I just got last week the very same problem with a quadri Xeon and 1GB of RAM:

scsi : 0 hosts
scsi : detected total
Partition check
VFS: Cannot open device 08:21
Kernel panic: VFS: Unable to mount root fs on 08:21
Many reboots later (and many configuration changes) I finally succeeded when I added an option when booting linux kernel:
   linux mem=128M expert

I checked on the web that other people already had this problem and fixed it (removing memory, adding boot option, etc...) It would have been nice if such an information had been clearly available at RedHat. I hope it will be. bye,


ANSWER: DNS on the fly

Tue, 10 Aug 1999 17:13:27 +0200

From: Jim Bradley -- Maryville, MO USA <[email protected]>

I have my laptop configured to plug into the network of my employer. At home, I plug my laptop into my home network, and dial out from another machine setup for dial on demand. Unfortunately, if it takes forever waiting for the two timeouts when trying to connect to the employer's DNS servers from home, and if I change the DNS order, it takes just as long for the timeout error when attempting to connect to my ISP's DNS from my employer's network. Is there an easy way to change the DNS servers when needed? It's easy enough to change IP addresses with the ifconfig command, is there a similar means for changing the DNS? Or, should I just bite the bullet and setup BIND on the laptop?

My apologies if it doesn't - I've made enough changes to my setup that I could have automated it myself. I don't keep multiple copies of /etc/resolv.conf yet get the correct DNS server. I know for certain that DHCP makes the update.

The only change I _remember_ making that's related to this is I generate the hosts file at bootup, since the only thing I keep in my hosts file is localhost and the hostname. Primarily because the long hostname can change based on which network I'm connected to (or even not connected at all).

Ted

C Ted Wise <[email protected]> replies:

Your DNS server(s) are defined in the /etc/resolv.conf file. If you're using DHCP or PPP, this should be updated automagically with the correct server. If you're defining everything by hand, you'll need to modify this file to reflect the correct DNS server. Changes to the file may not be reflected in already running programs (daemons).

If you're not running a DHCP server on your home network, consider one, it will greatly ease the pain of moving the laptop between locations.

The Linux Gazette Editor writes to Ted:

Since when did Linux PPP start automagically updating the DNS server? Windows does this, but in my experience Linux does not. You have to have several /etc/resolv.conf files, and use a symbolic link to point to the "current" one. You can have a shell script that does this and calls pppd.

Ted responds:

I've been using the KPPP dialer under KDE and that one definitely makes changes to the /etc/resolv.conf file. When it makes a connection, it modifies the file - commenting out the existing lines and adding ones applicable to the PPP connection. When you exit the application, it restores the original file.

From the comments in the file, it looks to be behavior specific to KPPP. This is where my confusion came in. My home server is running DNS and masqs through to the PPP interface so the /etc/resolv.conf file doesn't change based on the PPP connection. It's only my laptop that needs this and I was making the assumption (I know, I know) that KPPP was just a pretty face on PPPD.

[Conclusion: pppd knows nothing about /etc/resolv.conf. KPPP rewrites it on the fly. DHCP does the Right Thing somehow automatically. Any more comments? -Ed.]

Ernst-Udo Wallenborn <[email protected]> suggests:

i use the SCHEMES facility of the PCMCIA package to solve a related problem: how to use a laptop in two LANs with different IP addresses, different domains, and (naturally) different DNS servers.

Basically you set up a file /etc/pcmcia/network.opts which contains all network options, esp. something like

case "$ADDRESS" in
home,*,*,*)
[snip]
    SEARCH="domain.com"
    DNS_1="1.2.3.4"
    DNS_2=""
    DNS_3=""
[snip]
    ;;
work,*,*,*)
[snip]
    SEARCH="work.com"
    DNS_1="5.6.7.8"
    DNS_2=""
    DNS_3=""
[snip]

Then, when booting with lilo you can append SCHEME=home or SCHEME=work, or better write this into /etc/lilo.conf directly. and type 'home' or 'work' at the lilo prompt.

The whole procedure is described in detail here: www.suse.de/sdb/en/html/ke_pcmcia-scheme.html

and the PCMCIA package is available here: hyper.stanford.edu/~dhinds/pcmcia/pcmcia.html

hope this helps

--
Ernst-Udo Wallenborn
Laboratorium fuer Physikalische Chemie
ETH Zuerich


ANSWER: ipchains

Tue, 10 Aug 1999 15:19:38 -0600
From: Warren Young <[email protected]>

"Martin L. Ferguson" wrote:

I saw your "$0.02 Tip" response in Linux Gazette (copied below), but the URL for the "scipts" section was not included. Could you send it to me - I would like to look at a comprehensive ipchains configuration. Thanks.

[snip]

From the Gazette:

I think perhaps you are missing a few important rules, such as rules to allow DNS replies. My own script for enabling masquerading and firewalling is available at the URL below, in the "scripts" section.

The URL my message mentions was in the signature. It is apparently the policy of the Linux Gazette to chop signatures from messages, so it didn't appear in the Gazette. (I'm Cc'ing this message to the Gazette's editor, in case they want to fix that page.)

The URL is www.cyberport.com/~tangent/ix/scripts/

The scripts I refer to in my original message are "firewall-enable" and "firewall-disable".

[Added the URL to the previous article. The directory also contains some other scripts to tar a directory, replace tabs with spaces, do a hex dump, etc. And yes, I do chop off signatures. :) -Ed.]


ANSWER: gcc will not work

Fri, 13 Aug 1999 00:25:55 +0200 (CEST)
From: Roland Smith <[email protected]>

Hi,

I saw your e-mail in the Mailbag section in the Linux Gazette.

I think you have not installed the binutils package. This contains some programs that gcc needs to make executables out of a bunch of object files.

Hope this helps.


ANSWER: DHCP

Fri, 13 Aug 1999 00:33:38 +0200 (CEST)
From: Roland Smith <[email protected]>

Concerning your question of adding a Linux workstation to a network that uses DHCP:

You probably have a mini-HOWTO available (if you have installed them, which is wise): /usr/doc/HOWTO/mini/DHCPcd.gz

You'll need the DHCP client. Check if it is available in your distribution, or get it at ftp.kobe-u.ac.jp from the directory /pub/PC-UNIX/Linux/network/dhcp

If you're using Red Hat you can use the control-panel to set up eth0 for DHCP.

Hope this helps!


ANSWER: ppp connection

Fri, 13 Aug 1999 00:43:42 +0200 (CEST)
From: Roland Smith <[email protected]>

You wrote:

I have an interesting problem. I have configured ezppp, kppp, and gnome-ppp to connect to my mindspring account, and all three seem to be doing so just fine. However, when I startup netscape or any other internet application, I can't access the internet. It just sits there trying to lookup the host. No error message. No nothing. I am completely stumped. Any help would be appreciated.

Some things you could look at:

  1. Do you actually make a connection with ppp before starting netscape? You'll need additional software if you want to be able to dial in automagically every time you try to reach the internet.
  2. Have you added your ISP's name-server to /etc/resolv.conf?
  3. he /etc/host.conf file configured correctly? It should consist of these two lines:
    order hosts,bind
    multi on
    

Hope this helps!


ANSWER: ASCII to speach

Fri, 13 Aug 1999 01:34:06 +0200 (CEST)
From: Roland Smith <[email protected]>

From your mail in the Linux gazette it is not clear what you're looking

for.

Your subject line says you're looking for ascii to speech conversion. For that you could try "rsynth" or "festival". (look at freshmeat.net for URL's)

Voice recognition software for Linux is something else altogether. I think IBM has released some software for this.

[Thanks, Roland, for all your answers. -Ed]

Jimmy O'Regan <[email protected]> adds:

ASCII to speech and speech recognition are complete opposites, but you can find most software available for Linux for either purpose at the BLINUX site - http://leb.net/blinux/ or at http://leb.net/pub/blinux

J.


ANSWER: 2GB Limit in LINUX

Thu, 19 Aug 1999 16:08:23 -0700
From: Greg Morse <[email protected]>

This limit does not apply even if the BIOS does not support the large drive. I recently added an 8GB drive to an old Compaq prolinea 133. the DOS fdisk could see the drive but not use it. Linux (RH6.0) however happily created an 8GB filesystem on the drive.

JGM

Niels Elgaard Larsen <[email protected]> writes: 1. It is _not_ down to the BIOS. You can just give the geometry as arguments to 'fdisk' 2. Do not trust the information from the maker of the disk. I installed a 10 GB IBM disk. The geometry printed on the disk and shown on IBM's web-side was identical to the geometry of their 8GB disk. I think they rely on special software to make it work on Windows. I assumed sectors and # of heads were correct and computed # of cylinders from the capacity and fed it to cfdisk. It works.


ANSWER: Windows 98 inside Linux

Sat, 21 Aug 1999 08:39:45 -0400
From: Brian <[email protected]>

Dear Markus,

If you'll visit www.vmware.com, you'll see their product VMWare - written up in the July 1999 issue of Linux Journal, or for subscribers interactive.linuxjournal.com).

VMWare will allow you to run a number of different Virtual Machines on top of your Linux box. See the web page for the details. Oh - the price is $299, I'm considering it so that I can test Java on a Windows platform without actually having Windoze in control of my hardware. :)


ANSWER: Distributions

Wed, 25 Aug 1999 01:18:59 -0400
From: Steve Wolfe <[email protected]>

Someone more knowledgeable than I could probably tell you the exact differences between Suse and Red Hat. There is more activity on Red Hat.

A more important question is, "What Distribution are people around you using?"

Unix/Linux is not too hard to learn - but it is different than windows. Try to find a User's group and/or computer store that has Linux around and then you can see it and talk to people. I liked the book "Life with Unix" to give a good grounding on what to expect. The O'Reilly books are invaluable. I also like the printed collections of the Linux Documentation project containing the System's Administrator's Guide and the Network Administrators Guide and the How-tos.

I used to the idea of a dual boot system - so you can use either Linux or Win xx, but not at the same time. This works for a while. The drawback is that you cannot use both at the same time. The best order of events (briefly) is 1) partition, 2) install Winxx 3) install Linux and Lilo.

Two machines are better yet. With a small LAN you can then telnet or use an X-windowing program to use both machines - This is what I do now. Several X-server programs exist for Windows. Hummingbird's Exceed, Reflection's X-windows suite, and StarNet's (x-win32) are three good ones and I have used all three.

I have heard some use of virtual machines (vmware makes one) in which you can use two operating systems at the same time on the same machine - but I have not tried it.

After reading the documentation you can mount a FAT partition from Linux and use it as a way to transfer data back and forth between machines. If you have two machines the network takes care of the file transfers. Remember that a Unix/Linux text file has only linefeeds and a PC-DOS text file has Carriage return and Linefeed.

-Cheers,
Steve Wolfe


ANSWER: WORD to Postscript

Thu, 01 Jul 1999 14:14:54 -0400
From: Reno Derosier <[email protected]>

In regards to the .prn file you might try downloading Adobe's Postscript drivers for windows at www.adobe.com/prodindex/printerdrivers/main.html.

Reno Derosier


ANSWER: g++ and including files that use templates

Wed, 4 Aug 1999 00:13:59 -0700 (MST)
From: Rachael A. Ludwick <[email protected]> jac <[email protected]> writes:
Hello, my question is about the g++ compiler.I want to know if is able to link files that use templates and then aren't included in the main program (they are in different files, and only the header files are in the main program). I have try as:
         gcc main.cxx libro.cxx
        * main: #incude "libro.h"...
        * libro.cxx: #include "libro.h"...
	
But the compiler of Red Hat 6.0 gives me an error. Could you help me? Thanks.

Juan J.Alejandro ([email protected]) Girona (Spain)

------------------------------------------------------------------------

I'm not sure if this will help, but here goes...

An annoying thing about C++ is that templated classes require that both the declaration and the implementation be in the same file. Instead of actually putting both in one file, often the header file will have the line:

#include "class.cc"  // or whatever the implementaion file is called
near the end of the file (after the declaration of the class). In this case though, the implementation usually goes in a file called "class.template" and #include "class.template" will be put in "class.h" somewhere near the end of the file (after the complete declaration of the file).

Also, don't forget to guard your class from multiple include-ing by putting something like this as the first two lines:

#ifndef MYCLASS_H
#define MYCLASS_H
and something like this as the last line:
#endif // MYCLASS_H

Anyway, if you have the implementation and declaration in separate files, and you don't have this yet, than this may be your problem. Assuming this will fix your problem and you have a "main.cc" and templated "class.h" and "class.cc", you should be able to compile with:

g++ -I. main.cc

(of course assuming main.cc has #include "class.h").

Tell me if this helps...

Rachael Ludwick

--
[email protected]
http://www.u.arizona.edu/~raludwic

"Go Ye Lemmings into the World and Propagate!"


This page written and maintained by the Editor of Linux Gazette, [email protected]
Copyright © 1999, Specialized Systems Consultants, Inc.
Published in Issue 45 of Linux Gazette, September 1999


Copyright © 1999, AuthorName
Published in Issue 45 of Linux Gazette, September 1999


[ TABLE OF CONTENTS ] [ FRONT PAGE ]  Back  Next