[lug] search and replace

Chan Kar Heng khchan at cyberdude.com
Tue Dec 28 09:07:27 MST 1999


hi.

rather off topic question here... sorry for inconveniences, but it was
rather urgent.

i'm sorta new to c++... been wondering how i can do the following with
c++. tried looking around, but didn't really find any sort of
documentation for this..

in typical c, to do the following:

gcc mylib.c -o mylib.o
gcc mylib2.c -o mylib2.o
gcc mylib.o my.ib2.o main.c -o main

i make mylib.h, mylib2.h and declare functions in mylib.c and mylib2.c
using extern.. something like:

extern int myfunc(void);

how about in c++? how do i declare a class? i mean, i can't do this right?

extern class MyString
{
  ...
};

i tried compiling another way (where i just extracted the class declarations
and placed them in a .hpp file which was included by both other files) a
"simple" class earlier and it retuned this:

$ gcc n.o ntry.o -o ntry.exe
ntry.o(.text+0x125):ntry.cpp: undefined reference to `operator==(Names &, Names &)'
ntry.o(.text+0x173):ntry.cpp: undefined reference to `operator==(Names &, Names &)'
ntry.o(.text+0x1c1):ntry.cpp: undefined reference to `operator==(Names &, Names &)'


thanks in advance.

ps: happy new year!! 8-)




--------------------------------------------
i don't suffer from stress... i'm a carrier.
http://home.backroom.net/~bozo




More information about the LUG mailing list