<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000">
Buenas tardes, estoy con las librerías GDAL/OGR intentando convertir
unos ficheros a SHP. Estoy con windows utilizando QT y las gdal del
paquete OSGeo4W, pero al compilar obtengo este error:<br>
<br>
<span style="color: rgb(255, 0, 0);">release/mainwindow.o:mainwindow.cpp:(.text+0xb8):
<b>undefined reference to `OGRRegisterAll' </b></span>
<p style="margin: 0px; text-indent: 0px;"><span style="color:
rgb(255, 0, 0);">collect2: ld returned 1 exit status </span></p>
<p style="margin: 0px; text-indent: 0px;"><span style="color:
rgb(255, 0, 0);">mingw32-make[1]: ***
[release\prueba_4_enero.exe] Error 1 </span></p>
<p style="margin: 0px; text-indent: 0px;"><span style="color:
rgb(255, 0, 0);">mingw32-make: *** [release] Error 2 </span></p>
<p style="margin: 0px; text-indent: 0px;"><span style="font-weight:
600; color: rgb(255, 0, 0);">The process
"C:/Qt/mingw/bin/mingw32-make.exe" exited with code %2.</span></p>
<p style="margin: 0px; text-indent: 0px;"><span style="color:
rgb(255, 0, 0);">Error while building project prueba_4_enero
(target: Desktop)</span></p>
<p style="margin: 0px; text-indent: 0px;"><span style="color:
rgb(255, 0, 0);">When executing build step 'Make'<br>
</span></p>
<p style="margin: 0px; text-indent: 0px;"><span style="color:
rgb(255, 0, 0);"><br>
</span>La variables de sistema (PATH) las tengo así:<br>
<b>C:\OSGeo4W\apps\gdal-17\bin;C:\OSGeo4W\apps\gdal-17\lib</b><br>
</p>
<br>
y el fichero .pro del QT, así:<br>
<span style="color: rgb(0, 128, 0);">#-------------------------------------------------</span>
<pre style="margin: 0px; text-indent: 0px;"><span style="color: rgb(0, 128, 0);">#</span></pre>
<pre style="margin: 0px; text-indent: 0px;"><span style="color: rgb(0, 128, 0);"># Project created by QtCreator 2011-01-04T14:12:42</span></pre>
<pre style="margin: 0px; text-indent: 0px;"><span style="color: rgb(0, 128, 0);">#</span></pre>
<pre style="margin: 0px; text-indent: 0px;"><span style="color: rgb(0, 128, 0);">#-------------------------------------------------</span></pre>
<pre style="margin: 0px; text-indent: 0px;"><span style="color: rgb(128, 0, 128);">QT</span> += core gui</pre>
<pre style="margin: 0px; text-indent: 0px;"><span style="color: rgb(128, 0, 128);">TARGET</span> = prueba_4_enero</pre>
<pre style="margin: 0px; text-indent: 0px;"><span style="color: rgb(128, 0, 128);">TEMPLATE</span> = app</pre>
<pre style="margin: 0px; text-indent: 0px;"><span style="color: rgb(128, 0, 128);">SOURCES</span> += main.cpp\</pre>
<pre style="margin: 0px; text-indent: 0px;"> mainwindow.cpp</pre>
<pre style="margin: 0px; text-indent: 0px;"><span style="color: rgb(128, 0, 128);">HEADERS</span> += mainwindow.h</pre>
<pre style="margin: 0px; text-indent: 0px;"><span style="color: rgb(128, 0, 128);">FORMS</span> += mainwindow.ui</pre>
<pre style="margin: 0px; text-indent: 0px;"><span style="color: rgb(128, 0, 128);">INCLUDEPATH</span> += "C:/OSGeo4W/apps/gdal-17/<span style="color: rgb(128, 128, 0);">include</span>"
La aplicación no tiene mas que un botón con un evento que se lanza al pulsarlo:
<span style="color: rgb(128, 128, 0);">void</span><span style="color: rgb(192, 192, 192);"> </span>MainWindow<span style="color: rgb(0, 0, 0);">::</span>on_pushButton_clicked<span style="color: rgb(0, 0, 0);">()</span>
<span style="color: rgb(0, 0, 0);">{</span>
<span style="color: rgb(192, 192, 192);"> </span>OGRRegisterAll<span style="color: rgb(0, 0, 0);">();</span>
<span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 0, 128);">QMessageBox</span><span style="color: rgb(0, 0, 0);">::</span>aboutQt<span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 128, 0);">this</span><span style="color: rgb(0, 0, 0);">,</span>tr<span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 128, 0);">"Algo</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">sobre</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">QT"</span><span style="color: rgb(0, 0, 0);">));</span>
<span style="color: rgb(0, 0, 0);">}</span>
Y estos son los include:
<span style="color: rgb(0, 0, 128);">#include</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">"mainwindow.h"</span>
<span style="color: rgb(0, 0, 128);">#include</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">"ui_mainwindow.h"</span>
<span style="color: rgb(0, 0, 128);">#include</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);"><QMessageBox></span>
<span style="color: rgb(0, 0, 128);">#include</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">"ogrsf_frmts.h"</span>
<span style="color: rgb(0, 0, 128);">#include</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">"ogr_core.h"
</span>El error de undefined reference sale precisamente en la única función de la librería GDAL/OGR que estoy utilizando.
<span style="color: rgb(192, 192, 192);"></span>OGRRegisterAll<span style="color: rgb(0, 0, 0);"></span>().
La pregunta es: ¿alguien sabe porqué obtengo ese error?. He probado con otras funciones de la biblioteca con idéntico resultado.
</pre>
Muchas gracias,<br>
Rafa<br>
</body>
</html>