<div dir="ltr"><div>Hi,</div><div><br></div><div>
<span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-">I am a newbie in c ++ and gdal. <br></span></span></div><div><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-">
<span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-">I used the following command to compile gdal3.1.0 on windows successfully: <br></span></span></span></span></div><div><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><br></span></span></span></span></div><div><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-">nmake -f <a href="http://makefile.vc">makefile.vc</a> MSVC_VER=1910 WIN64=1 GDAL_HOME=path\to\gdal_home PROJ_INCLUDE=-IC:\OSGeo4W\include PROJ_LIBRARY=C:\OSGeo4W\lib\proj.lib SQLITE_INC=-Ipath\to\sqlite\include SQLITE_LIB=path\to\sqlite\lib\libsqlite3.lib devinstall</span></span></span></span></div><div><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><br></span></span></span></span></div><div><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-">But when I use std::string OGRPoint::exportToWkt() function, and compiled, get a LNK2019 error like that:  <br></span></span></span></span></div><div><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><br></span></span></span></span></div><div><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-">error LNK2019: unresolved external symbol "private: static int __cdecl OGRWktOptions::getDefaultPrecision(void)" (?getDefaultPrecision@OGRWktOptions@@CAHXZ),referenced in function "public: __cdecl OGRWktOptions::OGRWktOptions(void)" (??0OGRWktOptions@@QEAA@XZ)</span></span></span></span></div><div><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><br></span></span></span></span></div><div><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-">my code:</span></span></span></span></div><div><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><br></span></span></span></span></div><div><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-">#include <iostream><br><br>#include <ogrsf_frmts.h><br>#include <ogr_geometry.h><br><br>int main()<br>{<br>     GDALAllRegister();<br>    CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");<br><br>     GDALDataset *dataset;<br> dataset = (GDALDataset *)GDALOpenEx("D:\\Point.shp", GDAL_OF_VECTOR, nullptr, nullptr, nullptr);<br><br>  if (dataset == nullptr)<br>       {<br>             std::cerr << "Open failed.\n";<br>                exit(1);<br>      }<br><br>   OGRLayer *layer = dataset->GetLayer(0);<br><br>  OGRFeature *feature;<br>  layer->ResetReading();<br>     while ((feature = layer->GetNextFeature()) != nullptr)<br>     {<br><br>           OGRGeometry *geom = feature->GetGeometryRef();<br><br>           if (geom != nullptr)<br>          {<br>                     const std::string wkt = geom->toPoint()->exportToWkt();<br><br>                       // std::cout << "GEOM: " << wkt << std::endl;<br>             }<br>     }<br><br>   OGRFeature::DestroyFeature(feature);<br>  GDALClose(dataset);<br><br> return 0;<br>}</span></span></span></span></div><div><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><br></span></span></span></span></div><div><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-">CMakeLists.txt: <br></span></span></span></span></div><div><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><br></span></span></span></span></div><div><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-">cmake_minimum_required(VERSION 3.17)<br><br>project(gdal-sample VERSION 1.0.0 LANGUAGES CXX)<br>set(CMAKE_CXX_STANDARD 11)<br>set(CMAKE_CXX_STANDARD_REQUIRED ON)<br><br>find_package(GDAL REQUIRED)<br><br>add_executable(sample sample.cpp)<br><br>target_include_directories(sample PRIVATE ${GDAL_INCLUDE_DIR})<br><br>target_link_libraries(sample PRIVATE ${GDAL_LIBRARIES})</span></span></span></span></div><div><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><br></span></span></span></span></div><div><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-">
<span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-">Am I doing something wrong?</span></span></span></span></span></span></div><div><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><br></span></span></span></span></span></span></div><div><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-">thanks in advance!</span></span>

</span></span></span></span></div><div><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><br></span></span>

</span></span>

</div></div>