Re: [opensuse] Linking problem with g++ [off topic]

Thank you for your answers. I have used some inline functions, but it
seems that the compiler does not support inline functions implemented
elsewhere than in the header file.

On Tue, Apr 8, 2008 at 7:53 PM, Sam Clemens <clemens.sam1@xxxxxxxxx> wrote:

Bogdan Cristea wrote:

Sorry to use this list for my problem, but I really need a quick answer

I have defined a class into two files XP_class.h and XP_class.cpp
and use the header XP_class.h into another file xml_parser.cpp to
create an object in the main function. However, when compiling and
linking all the
files, I get the following error:

g++ `xml2-config --cflags` xml_parser.cpp XP_class.cpp `xml2-config --
libs` -o xml_parser
/tmp/ccX1d5Hj.o: In function `main':
xml_parser.cpp:(.text+0x195): undefined reference to `XP::XP()'
xml_parser.cpp:(.text+0x1a8): undefined reference to
`XP::init_DOM(char const*)'
xml_parser.cpp:(.text+0x1c2): undefined reference to `XP::~XP()'
xml_parser.cpp:(.text+0x229): undefined reference to
`XP::get_value(char const*)'
xml_parser.cpp:(.text+0x2b7): undefined reference to `XP::~XP()'
collect2: ld returned 1 exit status

I know that it must be some simple mistake, but I was not been able to
figure out what it is. I would appreciate your help.

Look for an error which is syntactically legal, but
semantically wrong (say like, a forgotten } character),
which would make your XP object definition be inside
another function.

C and C++ are notorious for indicating certain types
of errors after the line on which the actual mistake
is located.


To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

Bogdan Cristea
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

Relevant Pages

  • Re: Types in C
    ... Structs and unions are user-defined. ... definitions without direct compiler support. ... be portable to compilers that don't have inline functions". ...
  • Re: Inline Functions?
    ... that is, it suggests that the compiler ... void __cdecl main ... so the complete body of function func() should actually be placed from ... Maybe inline functions only suggests to the compiler that desired ...
  • Re: VLA question
    ... Just yesterday I was writing an Ising model (about to go on sourceforge). ... inline functions, defined in the header. ... In programming, the trivial is important, because of they way that one ... or migrate to a proper C compiler. ...
  • Re: XFree86 for athlon problems
    ... > may inline functions not marked as inline causing linking errors, ... packages, including the kernel, even though the rest is i386. ... be nice if the gcc man page would mention this. ... The AIX xlc compiler has rather dire warnings ...
  • Re: What is the gain of "inline"
    ... inline functions. ... If you want an inline function in asm ... I have used a compiler for Algol 68 where the only way to get inline ... SA1 R (load R in X1) ...