我构建了一个 QT Designer 自定义插件,它工作得很好......直到我添加一个不在同一个库中的标题......
如果我将此添加到 MTBFWidget.cpp/.h :
#include "KinectHandler.h"
插件找不到了。如果我删除它,它会起作用..这告诉我它找不到任何外部。我现在真的被困住了,我感谢各种形式的帮助..我认为我的问题可能是我的 CMakeLists.txt,它告诉了如何构建 dll/lib..这是我的 CMakeLists.txt:
########### Client Library ###############
find_package( Qt4 COMPONENTS QtCore QtGui QtOpenGL REQUIRED )
include( ${QT_USE_FILE} )
LINK_LIBRARIES( ${QT_LIBRARIES} )
SET (CLIENT_SOURCES client.cpp
mtbf.cpp
pose.cpp
MTBFReader.cpp
KinectHandler.cpp )
SET (CLIENT_HEADERS ${PROJECT_SOURCE_DIR}/include/client.h
${PROJECT_SOURCE_DIR}/include/mtbf.h
${PROJECT_SOURCE_DIR}/include/pose.h
${PROJECT_SOURCE_DIR}/include/MTBFReader.h
${PROJECT_SOURCE_DIR}/include/KinectHandler.h
)
ADD_LIBRARY(client SHARED ${CLIENT_SOURCES} ${CLIENT_HEADERS} ${CLIENT_MOC_SRC} ${UISrcs})
TARGET_LINK_LIBRARIES(client ${QT_LIBRARIES} ${Boost_LIBRARIES} ${ODYSSEUS_LIBRARIES})
###########################QT Designer Plugin ###################
set (PLUGIN_MOC_H ${PROJECT_SOURCE_DIR}/include/MTBFWidgetPlugin.h
${PROJECT_SOURCE_DIR}/include/mtbfwidget.h)
set (PLUGIN_SRCS MTBFWidgetPlugin.cpp
mtbfwidget.cpp)
include_directories(${PROJECT_SOURCE_DIR}/include
${QT_QTDESIGNER_INCLUDE_DIR} )
QT4_WRAP_CPP( MOCsrc ${PLUGIN_MOC_H} )
ADD_LIBRARY(mtbf_plugin SHARED ${MOCsrc} ${PLUGIN_MOC_H} ${PLUGIN_SRCS} )
add_dependencies(mtbf_plugin client )
SET_TARGET_PROPERTIES(mtbf_plugin PROPERTIES COMPILE_FLAGS "${QT_DEFINITIONS} -DQDESIGNER_EXPORT_WIDGETS -DQT_PLUGIN -DQT_NO_DEBUG -DQT_SHARED")
TARGET_LINK_LIBRARIES(mtbf_plugin ${QT_LIBRARIES} client ${Boost_LIBRARIES} ${ODYSSEUS_LIBRARIES})
set( QT_PLUGIN_PATH $ENV{QT_PLUGIN_PATH} )
if( QT_PLUGIN_PATH )
get_target_property( TMP_LIBRARY_PATH mtbf_plugin LOCATION )
add_custom_command( TARGET mtbf_plugin POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy ${TMP_LIBRARY_PATH} ${QT_PLUGIN_PATH}/designer )
endif( QT_PLUGIN_PATH )
编辑 :
任何与 QT 相关的包括作品。其他所有包括外部不
作品:
#include "QtGui\qabstractbutton.h"
不工作:
#include "boost\thread.hpp"
奇怪的是,我的程序可以找到所有这些文件,它甚至可以正确编译..