Hey @all,
I think i have somewhere read that XSLT isn't supported by QT at the moment.
Currently I use QT 4.4 for Windows. My Problem now is to use WebView/WebKit.
To work with XML and XSLT i decided to try Xerces-c and Xalan-c within my QT Project, but now I can't compile it.
My Compiler is MinGW.
When i try to compile i get the following error:Code:
###################################################################### # Automatically generated by qmake (2.01a) Tue Jun 10 10:37:08 2008 ###################################################################### TEMPLATE = app TARGET = win32 { DEPENDPATH += . \ C:/xerces/xerces-c-windows_2000-msvc_60/include \ C:/xalan/xalan-C_1_10_0-win32-msvc_60/include \ C:/xerces/xerces-c-windows_2000-msvc_60/lib \ C:/xalan/xalan-C_1_10_0-win32-msvc_60/lib \ C:/Boost/lib INCLUDEPATH += . \ C:/xerces/xerces-c-windows_2000-msvc_60/include \ C:/xalan/xalan-C_1_10_0-win32-msvc_60/include \ C:/Boost/include/boost-1_33_1 #win32:LIBS += -LC:\xerces\xerces-c-windows_2000-msvc_60\lib -lxerces-c_2 -LC:\xalan\xalan-C_1_10_0-win32-msvc_60\lib -lXalan-C_1 #LIBS += -lxerces-c_2.lib -lXalan-C_1.lib #win32:LIBS += C:/xerces/xerces-c-windows_2000-msvc_60/lib/xerces-c_2.lib \ # C:/xalan/xalan-C_1_10_0-win32-msvc_60/lib/Xalan-C_1.lib LIBS += -LC:\xerces\xerces-c-windows_2000-msvc_60\lib -LC:/xerces/xerces-c-windows_2000-msvc_60/lib -lxerces-c_2 -LC:/xalan/xalan-C_1_10_0-win32-msvc_60/lib -lXalan-C_1 \ -LC:/Boost/lib -lboost_regex-mgw-1_33_1 -lboost_python-mgw-1_33_1 } QT -= gui CONFIG += console # Input HEADERS += xerces_strings.hpp SOURCES += main.cpp
I hope somebody can help me, here is also the demofile (main.cpp)Quote:
C:\Documents and Settings\user\Desktop\XercesQTDemo>qmake && mingw32-make Release
mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory `C:/Documents and Settings/user/Desktop/XercesQTDemo'
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\..\..\Qt\4.4.0MinGW\include\QtCore" -I"..\..\..\..\Qt\4.4.0MinGW\include\QtCore" -I"..\..\..\..\Qt\4.4.0MinGW\include" -I"." -I"..\..\..\..\xerces\xerces-c-windows_2000-msvc_60\include" -I"..\..\..\..\xalan\xalan-C_1_10_0-win32-msvc_60\include" -I"..\..\..\..\Boost\include\boost-1_33_1" -I"..\..\..\..\Qt\4.4.0MinGW\include\ActiveQt" -I"release" -I"." -I"..\..\..\..\Qt\4.4.0MinGW\mkspecs\win32-g++" -o release\main.o main.cpp
In file included from main.cpp:22:
xerces_strings.hpp:25:46: warning: no newline at end of file
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -Wl,-subsystem,console -mthreads -Wl -o release\XercesQTDemo.exe release/main.o -L"c:\Qt\4.4.0MinGW\lib" -LC:\xerces\xerces-c-windows_2000-msvc_60\lib -LC:/xerces/xerces-c-windows_2000-msvc_60/lib -lxerces-c_2 -LC:/xalan/xalan-C_1_10_0-win32-msvc_60/lib -lXalan-C_1 -LC:/Boost/lib -lboost_regex-mgw-1_33_1 -lboost_python-mgw-1_33_1 -lQtCore4
release/main.o:main.cpp:(.text+0x67): undefined reference to `_imp___ZN11xercesc_2_76XMLUni22fgXercescDefaultLo caleE'
release/main.o:main.cpp:(.text+0x7e): undefined reference to `_imp___ZN11xercesc_2_716XMLPlatformUtils10Initial izeEPKcS2_PNS_12PanicHandlerEPNS_13MemoryManagerEb '
release/main.o:main.cpp:(.text+0x99): undefined reference to `_imp___ZN11xercesc_2_76XMLUni22fgXercescDefaultLo caleE'
release/main.o:main.cpp:(.text+0xb0): undefined reference to `_imp___ZN11xercesc_2_716XMLPlatformUtils10Initial izeEPKcS2_PNS_12PanicHandlerEPNS_13MemoryManagerEb '
release/main.o:main.cpp:(.text+0xb5): undefined reference to `xalanc_1_10::XalanMemMgrs::getDefaultXercesMemMgr ()'
release/main.o:main.cpp:(.text+0xbd): undefined reference to `xalanc_1_10::XalanTransformer::initialize(xercesc _2_7::MemoryManager&)'
release/main.o:main.cpp:(.text+0xcd): undefined reference to `xalanc_1_10::XalanMemMgrs::getDefaultXercesMemMgr ()'
release/main.o:main.cpp:(.text+0xdf): undefined reference to `xalanc_1_10::XalanTransformer::XalanTransformer(x ercesc_2_7::MemoryManager&)'
release/main.o:main.cpp:(.text+0xef): undefined reference to `xalanc_1_10::XalanMemMgrs::getDefaultXercesMemMgr ()'
release/main.o:main.cpp:(.text+0x10a): undefined reference to `xalanc_1_10::XSLTInputSource::XSLTInputSource(cha r const*, xercesc_2_7::MemoryManager&)'
release/main.o:main.cpp:(.text+0x11a): undefined reference to `xalanc_1_10::XalanMemMgrs::getDefaultXercesMemMgr ()'
release/main.o:main.cpp:(.text+0x135): undefined reference to `xalanc_1_10::XSLTInputSource::XSLTInputSource(cha r const*, xercesc_2_7::MemoryManager&)'
release/main.o:main.cpp:(.text+0x145): undefined reference to `xalanc_1_10::XalanMemMgrs::getDefaultXercesMemMgr ()'
release/main.o:main.cpp:(.text+0x160): undefined reference to `xalanc_1_10::XSLTResultTarget::XSLTResultTarget(c har const*, xercesc_2_7::MemoryManager&)'
release/main.o:main.cpp:(.text+0x197): undefined reference to `xalanc_1_10::XalanTransformer::transform(xalanc_1 _10::XSLTInputSource const&, xalanc_1_10::XSLTInputSource const&, xalanc_1_10::XSLTResultTarget const&)'
release/main.o:main.cpp:(.text+0x258): undefined reference to `xalanc_1_10::XSLTResultTarget::~XSLTResultTarget( )'
release/main.o:main.cpp:(.text+0x263): undefined reference to `vtable for xalanc_1_10::XSLTInputSource'
release/main.o:main.cpp:(.text+0x26d): undefined reference to `_imp___ZN11xercesc_2_711InputSourceD2Ev'
release/main.o:main.cpp:(.text+0x286): undefined reference to `vtable for xalanc_1_10::XSLTInputSource'
release/main.o:main.cpp:(.text+0x290): undefined reference to `_imp___ZN11xercesc_2_711InputSourceD2Ev'
release/main.o:main.cpp:(.text+0x2b4): undefined reference to `xalanc_1_10::XalanTransformer::~XalanTransformer( )'
release/main.o:main.cpp:(.text+0x2c1): undefined reference to `xalanc_1_10::XalanTransformer::terminate()'
release/main.o:main.cpp:(.text+0x2c7): undefined reference to `_imp___ZN11xercesc_2_716XMLPlatformUtils9Terminat eEv'
release/main.o:main.cpp:(.text+0x3fe): undefined reference to `xalanc_1_10::XSLTResultTarget::~XSLTResultTarget( )'
release/main.o:main.cpp:(.text+0x409): undefined reference to `vtable for xalanc_1_10::XSLTInputSource'
release/main.o:main.cpp:(.text+0x416): undefined reference to `_imp___ZN11xercesc_2_711InputSourceD2Ev'
release/main.o:main.cpp:(.text+0x42f): undefined reference to `vtable for xalanc_1_10::XSLTInputSource'
release/main.o:main.cpp:(.text+0x43c): undefined reference to `_imp___ZN11xercesc_2_711InputSourceD2Ev'
release/main.o:main.cpp:(.text+0x463): undefined reference to `xalanc_1_10::XalanTransformer::~XalanTransformer( )'
release/main.o:main.cpp:(.text+0x473): undefined reference to `xalanc_1_10::XalanTransformer::terminate()'
release/main.o:main.cpp:(.text+0x479): undefined reference to `_imp___ZN11xercesc_2_716XMLPlatformUtils9Terminat eEv'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [release\XercesQTDemo.exe] Error 1
mingw32-make[1]: Leaving directory `C:/Documents and Settings/user/Desktop/XercesQTDemo'
mingw32-make: *** [Release] Error 2
C:\Documents and Settings\user\Desktop\XercesQTDemo>
Regards NoRulezCode:
#include <QCoreApplication> #include <iostream> #include <xalanc/Include/PlatformDefinitions.hpp> #include <xalanc/XalanTransformer/XalanTransformer.hpp> #include <xalanc/XSLT/XSLTInputSource.hpp> #include <xalanc/XSLT/XSLTResultTarget.hpp> #include <xercesc/util/PlatformUtils.hpp> #if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(__TOS_WIN__) #if defined(_DEBUG) //#pragma comment(linker, "/NODEFAULTLIB:libcmt.lib") #pragma comment(lib, "xerces-c_2D.lib") //#pragma comment(lib, "xerces-depdom_2D.lib") #pragma comment(lib, "Xalan-C_1D.lib") #elif defined(NDEBUG) #pragma comment(lib, "xerces-c_2.lib") //#pragma comment(lib, "xerces-depdom_2.lib") #pragma comment(lib, "Xalan-C_1.lib") #endif #endif #include "xerces_strings.hpp" // Example 14-4 using namespace std; using namespace xercesc; using namespace xalanc; // RAII utility that initializes the parser and frees resources // when it goes out of scope struct XalanInitializer { XalanInitializer( ) { XMLPlatformUtils::Initialize( ); XalanTransformer::initialize( ); } ~XalanInitializer( ) { XalanTransformer::terminate( ); XMLPlatformUtils::Terminate( ); } }; int main(int argc, char* argv[]) { try { XMLPlatformUtils::Initialize(); XalanInitializer init; // Initialize Xalan. XalanTransformer xslt; // XSLT engine. XSLTInputSource xml("report.xml"); // XML document from // Example 14-1. XSLTInputSource xsl("report.xsl"); // Stylesheet from // Example 14-19. XSLTResultTarget html("report.html"); // xslt's output. Perform transformation. if (xslt.transform(xml, xsl, html) != 0) { cout << "xml error: " << xslt.getLastError( ) << "\n"; } } catch (const XMLException& e) { // cout << "xml error: " << toNative(e.getMessage( )) << "\n"; return EXIT_FAILURE; } catch (const exception& e) { cout << e.what( ) << "\n"; return EXIT_FAILURE; } return 0; }

