User forums > Using Code::Blocks

Application linker errors to Xercesc (XML Parser) with g++ compiler

(1/3) > >>

pradeep:
There are linker errors in referencing Namspace::XMLString though the libxerces-c_static_2D.a is added in linker settings and I tried to do go to declaration on XMLString by selecting the option of RMB menu, it throws a prompt saying undefined but the build successful in visual studio. So in codeblocks I am seeing linker error as "undefined reference to `_imp___ZN11xercesc_2_89XMLString7releaseEPPc'|" though the header file XMLString.hpp is added.

Can you help me on how to resolve these linker errors.


stahta01:
Add the library needed to fix the linking error.
http://wiki.codeblocks.org/index.php/FAQ-Compiling_%28errors%29#Q:_What_do_I_need_to_know_when_using_3rd_party_libs.3F

Tim S.

pradeep:
Hi Tim,

I have followed instructions and added the required includes and .a/.obj files at Linker settings.

I am still seeing the same undefined errors at line:

XERCES_CPP_NAMESPACE::XMLPlatformUtils::Initialize();

Is it due to gcc incompatibility with xerces scope resolution? It works perfectly in visual studio.

Thanks,
Pradeep

stahta01:

--- Quote from: pradeep on October 24, 2016, 07:37:45 pm ---Hi Tim,

I have followed instructions and added the required includes and .a/.obj files at Linker settings.

I am still seeing the same undefined errors at line:

XERCES_CPP_NAMESPACE::XMLPlatformUtils::Initialize();

Is it due to gcc incompatibility with xerces scope resolution? It works perfectly in visual studio.

Thanks,
Pradeep

--- End quote ---

Without more information I can NOT say what is the cause of the problem; but, user error is a good guess.

Do you know how to use Libraries?
Do you know you CAN NOT mix c++ libraries from different compilers and in some cases from different compiler versions?

Post a full build log as stated in the CB FAQs.

Tim S.

stahta01:
Wild guess is you forgot to define a macro that says you are planning on linking to a static or DLL library.

Read the library documentation to see if this guess is true.

From http://svn.apache.org/viewvc/xerces/c/trunk/doc/build.xml?view=markup

--- Code: ---<note>If you are linking your application to the static
316                   &XercesCName; library,
317                   then you will need to compile your application with the
318                   XERCES_STATIC_LIBRARY preprocessor macro defined in order
319                   to turn off the DLL import/export mechanism.</note>

--- End code ---

Please read the fine manual next time!

Tim S.

Navigation

[0] Message Index

[#] Next page

Go to full version