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.


regards



--
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