VC++ project Win32 to X64 bit migration issue: Linker error

aravind-alapati 1 Reputation point
2020-10-29T12:00:58.127+00:00

I was attempting to migrate VC++ project from Win32 to x64 below is the project configuration for the project

35950-image.png

I am getting the below build errors ( linker)

1>ResourceCompile:  
1>  Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1  
1>    
1>  Copyright (C) Microsoft Corporation.  All rights reserved.  
1>    
1>    
1>MSVCMRTD.lib(mstartup.obj) : error LNK2022: metadata operation failed (80131188) : Inconsistent field declarations in duplicated types (types: tagMSG; fields: <alignment member>): (0x04000037).  
1>MSVCMRTD.lib(mstartup.obj) : error LNK2022: metadata operation failed (80131188) : Inconsistent field declarations in duplicated types (types: _SECURITY_ATTRIBUTES; fields: <alignment member>): (0x04000044).  
1>MSVCMRTD.lib(managdeh.obj) : error LNK2022: metadata operation failed (80131188) : Inconsistent field declarations in duplicated types (types: tagMSG; fields: <alignment member>): (0x04000033).  
1>MSVCMRTD.lib(managdeh.obj) : error LNK2022: metadata operation failed (80131188) : Inconsistent field declarations in duplicated types (types: _SECURITY_ATTRIBUTES; fields: <alignment member>): (0x04000038).  
1>MSVCMRTD.lib(managdeh.obj) : error LNK2022: metadata operation failed (80131188) : Inconsistent field declarations in duplicated types (types: _TP_CALLBACK_ENVIRON; fields: <alignment member>): (0x0400003e).  
1>MSVCMRTD.lib(mehvecdtr.obj) : error LNK2022: metadata operation failed (80131188) : Inconsistent field declarations in duplicated types (types: tagMSG; fields: <alignment member>): (0x04000032).  
1>MSVCMRTD.lib(mehvecdtr.obj) : error LNK2022: metadata operation failed (80131188) : Inconsistent field declarations in duplicated types (types: _SECURITY_ATTRIBUTES; fields: <alignment member>): (0x04000037).  
1>MSVCMRTD.lib(mehvecdtr.obj) : error LNK2022: metadata operation failed (80131188) : Inconsistent field declarations in duplicated types (types: _TP_CALLBACK_ENVIRON; fields: <alignment member>): (0x04000038).  
1>MSVCMRTD.lib(msilexit.obj) : error LNK2022: metadata operation failed (80131188) : Inconsistent field declarations in duplicated types (types: tagMSG; fields: <alignment member>): (0x04000037).  
1>MSVCMRTD.lib(msilexit.obj) : error LNK2022: metadata operation failed (80131188) : Inconsistent field declarations in duplicated types (types: _SECURITY_ATTRIBUTES; fields: <alignment member>): (0x0400003f).  
1>MSVCMRTD.lib(msilexit.obj) : error LNK2022: metadata operation failed (80131188) : Inconsistent field declarations in duplicated types (types: _TP_CALLBACK_ENVIRON; fields: <alignment member>): (0x0400004a).  
1>MSVCMRTD.lib(puremsilcode.obj) : error LNK2022: metadata operation failed (80131188) : Inconsistent field declarations in duplicated types (types: tagMSG; fields: <alignment member>): (0x04000032).  
1>MSVCMRTD.lib(puremsilcode.obj) : error LNK2022: metadata operation failed (80131188) : Inconsistent field declarations in duplicated types (types: _SECURITY_ATTRIBUTES; fields: <alignment member>): (0x04000037).  
1>MSVCMRTD.lib(puremsilcode.obj) : error LNK2022: metadata operation failed (80131188) : Inconsistent field declarations in duplicated types (types: _TP_CALLBACK_ENVIRON; fields: <alignment member>): (0x0400003d).  
1>MSVCMRTD.lib(mstartup.obj) : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (tagMSG): (0x0200003a).  
1>MSVCMRTD.lib(mstartup.obj) : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (_SECURITY_ATTRIBUTES): (0x02000044).  
1>MSVCMRTD.lib(managdeh.obj) : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (tagMSG): (0x02000035).  
1>MSVCMRTD.lib(managdeh.obj) : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (_SECURITY_ATTRIBUTES): (0x0200003a).  
1>MSVCMRTD.lib(managdeh.obj) : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (_TP_CALLBACK_ENVIRON): (0x0200003b).  
1>MSVCMRTD.lib(mehvecdtr.obj) : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (tagMSG): (0x02000033).  
1>MSVCMRTD.lib(mehvecdtr.obj) : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (_SECURITY_ATTRIBUTES): (0x02000038).  
1>MSVCMRTD.lib(mehvecdtr.obj) : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (_TP_CALLBACK_ENVIRON): (0x02000039).  
1>MSVCMRTD.lib(msilexit.obj) : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (tagMSG): (0x0200003a).  
1>MSVCMRTD.lib(msilexit.obj) : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (_SECURITY_ATTRIBUTES): (0x0200003f).  
1>MSVCMRTD.lib(msilexit.obj) : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (_TP_CALLBACK_ENVIRON): (0x02000040).  
1>MSVCMRTD.lib(puremsilcode.obj) : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (tagMSG): (0x02000035).  
1>MSVCMRTD.lib(puremsilcode.obj) : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (_SECURITY_ATTRIBUTES): (0x0200003a).  
1>MSVCMRTD.lib(puremsilcode.obj) : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (_TP_CALLBACK_ENVIRON): (0x0200003b).  
1>LINK : fatal error LNK1255: link failed because of metadata errors  
1>  
1>Build FAILED.  
1>  
1>Time Elapsed 00:00:12.02  
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========  

I was able to solve the above error by changing the struct member alignment from /Zp4 to /Zp16, however this change is impacting other components, is there any way i can solve this error without changing the structure member alignment?

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,692 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.