问题
My application runs well if is the 32 bit version, but when I added the new 64 bit platform to the Configuration manager and tried to run it, I got the following message at startup:
回答1:
After reading 64bit manifest problem / side by side issue I concluded the problem was the manifest line
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
So I add to branch it, conditioned by the platform:
#ifdef _WIN64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
So, I add to turn it generic, independent of the platform:
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
Notice the difference in processorArchitecture value.
Now everything is working fine!
来源:https://stackoverflow.com/questions/43119204/application-gives-error-only-on-64-bit-version