对`xsltParseStylesheetAttributeSet'(libxslt)的未定义引用

时间:2017-04-16 14:42:32

标签: c++ linux xslt libxml2

我在C / C ++中有一些小项目,这是一个CmakeList文件

cmake_minimum_required(VERSION 2.8)

project (xmlcppwrapper)

file(GLOB SOURCE RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp")
file(GLOB HEADER RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.h")

if(CMAKE_COMPILER_IS_GNUCXX)
    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmessage-length=0 -Wall -fPIC")
    set( CMAKE_CXX_FLAGS_DEBUG   "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g3 -DDEBUG")
    set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3" )
endif(CMAKE_COMPILER_IS_GNUCXX)

include_directories(
    ${CMAKE_CURRENT_SOURCE_DIR}
    ${CMAKE_CURRENT_BINARY_DIR}
    /usr/local/include/libxml2/
    /usr/local/include/libxslt/
)

add_library(
    ${CMAKE_PROJECT_NAME}
    ${SOURCE}
)


target_link_libraries(
    ${CMAKE_PROJECT_NAME}
    xml2
)

add_executable(
    parser_h
    ${CMAKE_CURRENT_SOURCE_DIR}/example/main.cpp
)
target_link_libraries(
        parser_h
    ${CMAKE_PROJECT_NAME}
)

install(FILES ${HEADER} DESTINATION include) 
install(TARGETS ${CMAKE_PROJECT_NAME} DESTINATION lib) 

在/ usr / local / include / libxml2和xslt文件夹中有* .h文件,在/ usr / local / lib文件夹中有libxml2.so和libxslt.so文件

当我想编译main.cpp

#include <iostream>
#include <fstream>
#include <cstring>
#include <xsltInternals.h>
#include <libxml2/libxml/xmlstring.h>
#include <attributes.h>

using namespace std;

int main(int argc, char* argv[]) {

    xsltStylesheetPtr style = (xsltStylesheetPtr) "";//xsltParseStylesheetFile((const xmlChar *) argv[1]);
    xmlNodePtr cur = (xmlNodePtr) "";

    xsltParseStylesheetAttributeSet(style,cur);

return 0;

}

我总是犯错误 undefined reference to `xsltParseStylesheetAttributeSet' 我该怎么办呢?我做错了什么? 谢谢

0 个答案:

没有答案