Overview
Artifact ID: | dba32f77e38cd133df67d0c60df3006f5ed8970131215124f5fcd4cf18eee875 |
---|---|
Ticket: | d90247c72808a8e7cb5c3b910e6b7a96e46d8d12
Warnings compiling in Windows with MingW |
User & Date: | anonymous 2023-07-24 10:16:09 |
Changes
- foundin changed to: "3.3.0"
- icomment:
When compiling applications that use MySQL++ with MingW (GNU-C for Windows), two warnings appear that can be avoided: Warning 1: C:\MySQL++\3.3.0\include/common.h:56: warning: "NOMINMAX" redefined 56 | #define NOMINMAX Solution: We can prevent this by changing "common.h" with when #defining NOMINMAX: //Don't define NOMINMAX when compiling with GNU C (MingW) #if !defined (__GNUC__) // Don't let windows.h (via Connector/C) #define min/max #define NOMINMAX #endif Warning 2: "warning: type attributes ignored after type is already defined [-Wattributes]" This warning appears in several files, for example: C:\MySQL++\3.3.0\include/cpool.h:42:22: warning: type attributes ignored after type is already defined [-Wattributes] 42 | class MYSQLPP_EXPORT Connection; Solution: Changing the definition of MYSQLPP_EXPORT in common.h: // Define DLL import/export tags for Windows compilers, where we build // the library into a DLL, for LGPL license compatibility reasons. // (This is based on a similar mechanism in wxWindows.) #if defined (__GNUC__) //Don't set DLL import/export tags for GNU C (MingW) #define MYSQLPP_EXPORT #else #ifdef MYSQLPP_MAKING_DLL // When making the DLL, export tagged symbols, so they appear // in the import library. #define MYSQLPP_EXPORT __declspec(dllexport) #elif !defined(MYSQLPP_NO_DLL) // We must be _using_ the DLL, so import symbols instead. #define MYSQLPP_EXPORT __declspec(dllimport) #else // Not making a DLL at all, so no-op these declspecs #define MYSQLPP_EXPORT #endif #endif Hope this helps! M
- login: "anonymous"
- mimetype: "text/plain"
- private_contact changed to: "6b6e81fe47844b8a0c44c73c70f577f7454cbb3f"
- severity changed to: "Minor"
- status changed to: "Open"
- title changed to: "Warnings compiling in Windows with MingW"
- type changed to: "Code Defect"