Monday, July 23, 2018

c++ - Compiler warnings with MySQL++ with release configuration




For some reason I get some warnings about "non dll-interface class" when building with a release configuration, but not debug.



I've compared the release and debug configurations, and my ones with the MySQL++ example ones, however I cant see which setting is causing these warnings.



1>c:\sql\mysql 5.0\mysql++-3.0.9\lib\qparms.h(49) : warning C4275: non dll-interface class 'std::_Container_base_aux' used as base for dll-interface class 'std::_Container_base_aux_alloc_real<_Alloc>'
1> with
1> [
1> _Alloc=std::allocator
1> ]
1> C:\apps\Microsoft Visual Studio 9.0\VC\include\xutility(377) : see declaration of 'std::_Container_base_aux'

1>c:\sql\mysql 5.0\mysql++-3.0.9\lib\result.h(212) : warning C4275...


Code snippet from the warning:



class MYSQLPP_EXPORT SQLQueryParms : public std::vector
{
...



The obvious thing to me seems to be that I'm not using a dll version of the CRT, however since I am ("Multi-threaded DLL (/MD)" for release) this cant be the problem, so must be somewhere else...



MYSQLPP_EXPORT is defined as "__declspec(dllexport)"



Compiler command line, I made some of the paths shorter for readability, however all the flags etc are the same.



/O2 /Oi /GL /I "C:\SQL\MySQL 5.0\\include\\" /I "C:\SQL\MySQL 5.0\mysql++-3.0.9\\lib\\" /D "NDEBUG" /D "_WIN32" /D "_MBCS" /FD /EHsc /MD /Gy /Yu"precompiled.h" /Fp"C:\...\server.pch" /Fo"C:\..." /Fd"C:\...\vc90.pdb" /W3 /nologo /c /Zi /TP /errorReport:prompt


And for a MySQL++ example.




/Od /I "C:\SQL\MySQL 5.0\\include" /I "..\lib" /D "_CONSOLE" /D "UNICODE" /D "_UNICODE" /FD /EHsc /MD /Fo"C:\SQL\MySQL 5.0\mysql++-3.0.9\vc2008\Release\simple1\\" /Fd"C:\SQL\MySQL 5.0\mysql++-3.0.9\vc2008\Release\simple1.pdb" /W3 /nologo /c /TP /errorReport:prompt

Answer




The obvious thing to me seems to be
that I'm not using a dll version of
the CRT, however since I am
("Multi-threaded DLL (/MD)" for
release) this cant be the problem, so

must be somewhere else...



1>c:\sql\mysql 5.0\mysql++-3.0.9\lib\qparms.h(49) : warning C4275: non dll-interface  


class 'std::_Container_base_aux' used
as base for dll-interface class
'std::_Container_base_aux_alloc_real<_Alloc>'





This is a warning we ignore safely along with C4251 when dealing with code that sends STL across DLL boundaries. The warning is letting you know that if the other dll was built with some other STL version (which it can't figure out off hand) than the footprint of the class is going to differ between the imported/exported versions of the class.



I know you are using VS 2008, but MSDN seems to hint that for 2005 your exact situation can be safely ignored:




C4275 can be ignored in Microsoft
Visual C++ 2005 if you are deriving
from a type in the Standard C++
Library, compiling a debug release
(/MTd) and where the compiler error

message refers to _Container_base.




Notice the reference to "debug release" and _Container_base


No comments:

Post a Comment

plot explanation - Why did Peaches&#39; mom hang on the tree? - Movies &amp; TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...