User forums > Using Code::Blocks
Application linker errors to Xercesc (XML Parser) with g++ compiler
pradeep:
--- Quote ---<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 quote ---
Hi Tim,
Thanks for your response,
I have added the macro XERCES_STATIC_LIBRARY in Compiler settings -> #defines, but still I am seeing the undefined reference to errors.
--- 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.
--- End quote ---
Hi Tim,
I have built the xerces library with g++ compiler and got static lib and dll libxerces-c_static_2D.a and xerces-c_static_2D.dll which I am using in my application.
here is the build log:
for the first project:
mingw32-g++.exe -g -W -O0 -DWIN32 -D_DEBUG -D_LIB -c XXX.cpp -o ..\..\obj\w2k\dbg\src\w2k\XXX.o this continues for all the files
for the second project:
mingw32-g++.exe -W -O0 -DXERCES_STATIC_LIBRARY -D_DEBUG -DWIN32 -D_CONSOLE -DIL_STD -DOSLMSDLL -DINTEL -IC:\Libraries\xerces-c_2_8_0\include -I
Regards,
Pradeep
stahta01:
Post the full build log or I will just ignore you!!!
You DID NOT even post the linking command!!!
Tim S.
pradeep:
Hi Tim,
Hope you are doing good,
I have removed all the warnings, undefined reference to errors from the build log and kept the build commands:
mingw32-g++.exe -g -W -O0 -DWIN32 -D_DEBUG -D_LIB -c src\w2k\hi.cpp -o ..\..\obj\w2k\dbg\src\w2k\hi.o
cmd /c if exist .\..\..\lib\w2k\dbg\lib.a del .\..\..\lib\w2k\dbg\lib.a
ar.exe -r -s .\..\..\lib\w2k\dbg\Lib.a
ar.exe: creating .\..\..\lib\w2k\dbg\lib.a
Output file is .\..\..\lib\w2k\dbg\lib.a with size 5.21 MB
mingw32-g++.exe -W -O0 -DXERCES_STATIC_LIBRARY -D_DEBUG -DWIN32 -D_CONSOLE -DIL_STD -DINTEL -I -I\include -I..\..\.. ..\..\src\w2k -c \src\w2k\hello.cpp -o ..\..\obj\w2k\dbg\src\w2k\hello.o
In file included from /xercesc/validators/datatype/DatatypeValidator.hpp:27:0,
from /xercesc/framework/XMLAttr.hpp:28,
from /xercesc/framework/XMLDocumentHandler.hpp:28,
from /xercesc/parsers/AbstractDOMParser.hpp:26,
from /xercesc/parsers/XercesDOMParser.hpp:27,
\src\w2k\r.cpp: In function 'int main(int, char**)':
mingw32-g++.exe -W -O0 -DXERCES_STATIC_LIBRARY -D_DEBUG -DWIN32 -D_CONSOLE -DIL_STD -DINTEL -I -I\include -I
In file included from /xercesc/validators/datatype/DatatypeValidator.hpp:27:0,
from /xercesc/framework/XMLAttr.hpp:28,
from /xercesc/framework/XMLDocumentHandler.hpp:28,
from /xercesc/parsers/AbstractDOMParser.hpp:26,
from /xercesc/parsers/XercesDOMParser.hpp:27,
from \src\w2k\hello1.cpp:19:
mingw32-g++.exe -W -O0 -DXERCES_STATIC_LIBRARY -D_DEBUG -DWIN32 -D_CONSOLE -DIL_STD -DINTEL -I -I\include -I
mingw32-c++.exe -L..\..\..\\lib\w2k\dbg -L\lib -Lxerces-c_2_8_0\lib -Lxerces-c_2_8_0\bin -o
Regards,
Pradeep
stahta01:
--- Code: ---mingw32-c++.exe -L..\..\..\\lib\w2k\dbg -L\lib -Lxerces-c_2_8_0\lib -Lxerces-c_2_8_0\bin -o
--- End code ---
Did you try linking to the library; because what you posted shows that you did NOT do that?
Tim S.
stahta01:
I have decided you must be a troll; because you refuse to post the information needed to help you!
Edit2: You need to decide are you using a Shared(DLL) or static Library; and you need to tell me which you are trying to do!!
Edit: In order to help you I need to know if you defined XERCES_STATIC_LIBRARY or NOT!!!
I need to know after defining or removing the define of XERCES_STATIC_LIBRARY; that you rebuilt the project.
I need to see the link command with at least one error included!!
Tim S.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version