0
我想讓我的程序在Windows上運行。它依賴於GDAL,一個用於加載GIS數據的庫。它在Linux和MacOS上編譯和鏈接都很好。我使用的CMake與MinGW和我遇到鏈接錯誤是這樣的:用VS2017GDAL不鏈接
undefined reference to `GDALRasterBand::RasterIO(GDALRWFlag, int, int, int, int, void*, int, int, GDALDataType, long, long, GDALRasterIOExtraArg*)'
CMakeFiles\Routes.dir/objects.a(elevation.cpp.obj): In function `ZN13ElevationData9calcStatsEv':
C:/Users/Logan/Documents/Routes/src/elevation/elevation.cpp:138: undefined reference to `GDALDataset::GetRasterXSize()'
C:/Users/Logan/Documents/Routes/src/elevation/elevation.cpp:139: undefined reference to `GDALDataset::GetRasterYSize()'
CMakeFiles\Routes.dir/objects.a(elevation.cpp.obj): In function `ZN13ElevationData17createOpenCLImageEv':
C:/Users/Logan/Documents/Routes/src/elevation/elevation.cpp:206: undefined reference to `GDALRasterBand::RasterIO(GDALRWFlag, int, int, int, int, void*, int, int, GDALDataType, long, long, GDALRasterIOExtraArg*)'
我編譯GDAL,我已經驗證了它安裝在哪裏我在CMake的文件正在指定。這裏是的CMakeLists.txt的相關部分:
IF (WIN32)
message(STATUS "Compiling for Windows")
set(GDAL_LIBRARY "C:/warmerda/bld/lib/gdal_i.lib")
set(GDAL_INCLUDE_DIR "C:/warmerda/bld/include/")
find_package(OpenCL REQUIRED)
include_directories(${OpenCL_INCLUDE_DIRS})
ELSE()
...
message(STATUS ${GDAL_LIBRARY})
target_link_libraries(Routes ${GDAL_LIBRARY} ${OpenCL_LIBRARIES})
我幾乎沒做開發在Windows所以我有點卡住。我試圖鏈接反對的DLL也無濟於事。有任何想法嗎?
謝謝,我想了一會兒,但忘了我發佈的問題。 – BlueSpud