昨天我下載了Qt4 Opensource library for linux。運行編譯錯誤:「找不到-lQtCore4」
./configure
./make
./make install
並插入到我的.bashrc文件之後:
PATH=/usr/local/TrollTech/Qt-4.7.3/bin:$PATH
export PATH
在此之後,我爲了產生一個Makefile,我跑出cmake的。的CMakeLists.txt:
project(VTKToVTFx)
cmake_minimum_required(VERSION 2.6)
find_package(VTK REQUIRED)
find_package(Qt4 REQUIRED)
include(${VTK_USE_FILE})
include(${QT_USE_FILE})
SET(VTK_TO_VTFX_FORMS main.ui)
QT4_WRAP_UI(VTK_TO_VTFX_FORMS_UIC ${VTK_TO_VTFX_FORMS})
SET(MOC_HEADERS VTKToVTFx.h)
qt4_wrap_cpp(MOC_OUTFILES ${MOC_HEADERS})
SET(CPP_SOURCES VTKToVTFx.cpp
VTKPatch.cpp
VTKFile.cpp
VTKData.cpp
VTKDataHolder.cpp
)
add_executable(VTKToVTFx ${CPP_SOURCES} ${VTK_TO_VTFX_FORMS_UIC} ${MOC_OUTFILES})
# Adds folders for Visual Studio solution explorer (and for Xcode explorer)
source_group("Generated" FILES ${MOC_FILES_CPP} ${VTK_TO_VTFX_FORMS_UIC} ${QRC_FILES_CPP} ${MOC_OUTFILES})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(VTKToVTFx vtkHybrid)
target_link_libraries(VTKToVTFx QtCore4)
target_link_libraries(VTKToVTFx QtGUI4)
此的CMakeLists.txt完美的作品以及在Windows,但是當我嘗試編譯我的Ubuntu安裝的輸出,出現此錯誤:
/usr/bin/ld: cannot find -lQtCore4
/usr/bin/ld: cannot find -lQtGUI4
任何誰可以點我到我的問題在這裏?
斜線?反斜槓? Linux呢?視窗? –
對不起,我確實使用了正確的斜線,但是在這裏寫錯了。我上面更新了我的帖子。我使用的是Ubuntu 11.04。 –
你爲什麼不使用[現有軟件包](http://packages.ubuntu.com/natty/libqt4-dev)的任何原因? – sehe