[gdal-dev] Using GDAL with opencv in C++ there is errors under windows
Raivo Rebane
raivo at r-systems.ee
Tue Mar 7 00:32:18 PST 2023
Hi again
I minimized the program :
#include <gdal.h>
#include <gdal_priv.h>
#include <iostream>
#include <conio.h>
int main()
{
GDALAllRegister();
GDALDataset* dataset =
static_cast<GDALDataset*>(GDALOpen("634632_2012_tava.tiff", GA_ReadOnly));
GDALClose(dataset);
return 0;
}
but it gives the same errors ?
If I remove
#include <gdal_priv.h>
Warnings stop to come
Can anybody help me ?
Regards
Raivo
On 06.03.23 17:04, Raivo Rebane wrote:
> Hi
>
> I am big problem. My program gives errors:
>
> Severity Code Description Project File Line Suppression
> State
> Warning C4251 'CPLJSONObject::m_osKey': class
> 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>'
> needs to have dll-interface to be used by clients of class
> 'CPLJSONObject' project2 C:\Program
> Files\PostgreSQL\15\include\cpl_json.h 153
> Warning C4251 'OGRStyleTable::osLastRequestedStyleName': class
> 'CPLString' needs to have dll-interface to be used by clients of class
> 'OGRStyleTable' project2 C:\Program
> Files\PostgreSQL\15\include\ogr_featurestyle.h 89
> Warning C4251 'OGR_SRSNode::m_listener': class
> 'std::weak_ptr<OGR_SRSNode::Listener>' needs to have dll-interface to
> be used by clients of class 'OGR_SRSNode' project2 C:\Program
> Files\PostgreSQL\15\include\ogr_spatialref.h 129
> Warning C4251 'OGRSpatialReference::d': class
> 'std::unique_ptr<OGRSpatialReference::Private,std::default_delete<OGRSpatialReference::Private>>'
> needs to have dll-interface to be used by clients of class
> 'OGRSpatialReference' project2 C:\Program
> Files\PostgreSQL\15\include\ogr_spatialref.h 159
> Warning C4251 'OGRCoordinateTransformationOptions::d': class
> 'std::unique_ptr<OGRCoordinateTransformationOptions::Private,std::default_delete<OGRCoordinateTransformationOptions::Private>>'
> needs to have dll-interface to be used by clients of struct
> 'OGRCoordinateTransformationOptions' project2 C:\Program
> Files\PostgreSQL\15\include\ogr_spatialref.h 775
> Warning C4251 'OGRCurve::ConstIterator::m_poPrivate': class
> 'std::unique_ptr<OGRCurve::ConstIterator::Private,std::default_delete<OGRCurve::ConstIterator::Private>>'
> needs to have dll-interface to be used by clients of class
> 'OGRCurve::ConstIterator' project2 C:\Program
> Files\PostgreSQL\15\include\ogr_geometry.h 948
> Warning C4251 'OGRSimpleCurve::Iterator::m_poPrivate': class
> 'std::unique_ptr<OGRSimpleCurve::Iterator::Private,std::default_delete<OGRSimpleCurve::Iterator::Private>>'
> needs to have dll-interface to be used by clients of class
> 'OGRSimpleCurve::Iterator' project2 C:\Program
> Files\PostgreSQL\15\include\ogr_geometry.h 1067
> Warning C4251 'OGRSimpleCurve::ConstIterator::m_poPrivate':
> class
> 'std::unique_ptr<OGRSimpleCurve::ConstIterator::Private,std::default_delete<OGRSimpleCurve::ConstIterator::Private>>'
> needs to have dll-interface to be used by clients of class
> 'OGRSimpleCurve::ConstIterator' project2 C:\Program
> Files\PostgreSQL\15\include\ogr_geometry.h 1084
> Warning C4251 'OGRGeometryFactory::TransformWithOptionsCache::d':
> class
> 'std::unique_ptr<OGRGeometryFactory::TransformWithOptionsCache::Private,std::default_delete<OGRGeometryFactory::TransformWithOptionsCache::Private>>'
> needs to have dll-interface to be used by clients of class
> 'OGRGeometryFactory::TransformWithOptionsCache' project2 C:\Program
> Files\PostgreSQL\15\include\ogr_geometry.h 2883
> Warning C4251 'OGRFeature::FieldValue::m_poPrivate': class
> 'std::unique_ptr<OGRFeature::FieldValue::Private,std::default_delete<OGRFeature::FieldValue::Private>>'
> needs to have dll-interface to be used by clients of class
> 'OGRFeature::FieldValue' project2 C:\Program
> Files\PostgreSQL\15\include\ogr_feature.h 385
> Warning C4251 'OGRFeature::ConstFieldIterator::m_poPrivate':
> class
> 'std::unique_ptr<OGRFeature::ConstFieldIterator::Private,std::default_delete<OGRFeature::ConstFieldIterator::Private>>'
> needs to have dll-interface to be used by clients of class
> 'OGRFeature::ConstFieldIterator' project2 C:\Program
> Files\PostgreSQL\15\include\ogr_feature.h 528
> Warning C4251 'GDALMajorObject::sDescription': class 'CPLString'
> needs to have dll-interface to be used by clients of class
> 'GDALMajorObject' project2 C:\Program
> Files\PostgreSQL\15\include\gdal_priv.h 137
> Warning C4251 'GDALDefaultOverviews::osOvrFilename': class
> 'CPLString' needs to have dll-interface to be used by clients of class
> 'GDALDefaultOverviews' project2 C:\Program
> Files\PostgreSQL\15\include\gdal_priv.h 190
> Warning C4251 'GDALDataset::Bands::Iterator::m_poPrivate': class
> 'std::unique_ptr<GDALDataset::Bands::Iterator::Private,std::default_delete<GDALDataset::Bands::Iterator::Private>>'
> needs to have dll-interface to be used by clients of class
> 'GDALDataset::Bands::Iterator' project2 C:\Program
> Files\PostgreSQL\15\include\gdal_priv.h 473
> Warning C4251 'GDALDataset::Layers::Iterator::m_poPrivate':
> class
> 'std::unique_ptr<GDALDataset::Layers::Iterator::Private,std::default_delete<GDALDataset::Layers::Iterator::Private>>'
> needs to have dll-interface to be used by clients of class
> 'GDALDataset::Layers::Iterator' project2 C:\Program
> Files\PostgreSQL\15\include\gdal_priv.h 669
> Warning C4251 'GDALDataset::Features::Iterator::m_poPrivate': class
> 'std::unique_ptr<GDALDataset::Features::Iterator::Private,std::default_delete<GDALDataset::Features::Iterator::Private>>'
> needs to have dll-interface to be used by clients of class
> 'GDALDataset::Features::Iterator' project2 C:\Program
> Files\PostgreSQL\15\include\gdal_priv.h 727
> Warning C4251 'GDALColorTable::aoEntries': class
> 'std::vector<GDALColorEntry,std::allocator<GDALColorEntry>>' needs to
> have dll-interface to be used by clients of class 'GDALColorTable'
> project2 C:\Program Files\PostgreSQL\15\include\gdal_priv.h 968
> Warning C4251 'GDALDriverManager::oMapNameToDrivers': class
> 'std::map<CPLString,GDALDriver
> *,std::less<CPLString>,std::allocator<std::pair<const
> CPLString,GDALDriver *>>>' needs to have dll-interface to be used by
> clients of class 'GDALDriverManager' project2 C:\Program
> Files\PostgreSQL\15\include\gdal_priv.h 1556
> Error LNK2001 unresolved external symbol "public: virtual class
> OGRGeometry * __cdecl OGRGeometry::MakeValid(void)const "
> (?MakeValid at OGRGeometry@@UEBAPEAV1 at XZ) project2
> C:\Users\Raivo\source\Repos\cv46srcDD\project2\Source.obj 1
> Error LNK2019 unresolved external symbol "public: void __cdecl
> OGRFeature::SetField(int,union OGRField *)"
> (?SetField at OGRFeature@@QEAAXHPEATOGRField@@@Z) referenced in function
> "public: void __cdecl OGRFeature::SetField(char const *,union OGRField
> *)" (?SetField at OGRFeature@@QEAAXPEBDPEATOGRField@@@Z) project2
> C:\Users\Raivo\source\Repos\cv46srcDD\project2\Source.obj 1
>
> I trying with examples.
>
> Headers are :
>
> #include <gdal.h>
> #include <cpl_json.h>
> #include <gdal_priv.h>
> #include "opencv2/imgcodecs.hpp"
> #include "opencv2/highgui.hpp"
> #include <iostream>
> #include <conio.h>
>
> What I mus do ?
>
> Regards
>
> Raivo
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
More information about the gdal-dev
mailing list