Opened 7 years ago

Closed 7 years ago

#6925 closed defect (duplicate)

Incorrect debug VC++ compiler flags in nmake.opt

Reported by: xcgh7712 Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: unspecified
Severity: normal Keywords:
Cc:

Description

The DEBUG OPTFLAGS for the root nmake.opt are incorrect. The debug builds are currently linking to the release mode MSVCR##.dll (compiler switch /MD) instead of the debug mode MSVCR##D.dll (compiler switch /MDd).

Also, the DEBUG OPTFLAGS #define DEBUG, but not _DEBUG. There should be both /DDEBUG and /D_DEBUG switches.

To summarize: /MD in DEBUG builds should be /MDd, need both /DDEBUG and /D_DEBUG

Without these changes, GDAL objects will appear to have incorrect values in their member variables when a debug build of Visual C++ project uses the debug build of the GDAL DLL. Also, heap corruption will occur if a GDAL class is new'd outside of the GDAL DLL then delete'd inside of the GDAL DLL, or vice versa.

Change History (1)

comment:1 by Even Rouault, 7 years ago

Resolution: duplicate
Status: newclosed

Duplicate of https://trac.osgeo.org/gdal/ticket/6384 and many other tickets

Note: See TracTickets for help on using tickets.