简体   繁体   English

VS2010本机多目标

[英]VS2010 Native Multi-Targeting

I have VS2005, VS2008, and VS2010 installed on my Win7 development machine. 我在Win7开发机器上安装了VS2005,VS2008和VS2010。 I have one particular project that uses a 3rd party DLL that gets an exception during the LoadLibrary() call when the EXE project is built by VS2010 (when targeting either the v100 or v90 toolset.) It works perfectly when built by directly VS2005 or VS2008. 我有一个使用第三方DLL的特定项目,当VS2010构建EXE项目时(在以v100或v90工具集为目标时),在LoadLibrary()调用期间会获取异常。当直接由VS2005或VS2008构建时,它可以完美地工作。

According to Li Shao's (of Microsoft) 2009 blog entry: 根据李少(Microsoft的)2009年博客文章:

http://blogs.msdn.com/b/vcblog/archive/2009/12/08/c-native-multi-targeting.aspx http://blogs.msdn.com/b/vcblog/archive/2009/12/08/c-native-multi-targeting.aspx

I should be able to open the VS2010 project and change the Platform Toolset from v100 to v90 and then VS2010 will actually use the VS2008 compiler, headers and libraries to build the program. 我应该能够打开VS2010项目并将Platform Toolset从v100更改为v90,然后VS2010实际上将使用VS2008编译器,标头和库来构建程序。 If it is, then it isn't doing it "right" because the DLL will not load when the project is built this way. 如果是这样,那么它就不会“正确”地进行操作,因为以这种方式构建项目时不会加载DLL。 I tried looking at the build log to verify which compiler is used, but there are no paths or version numbers in my logs, so that was a bust. 我尝试查看构建日志以验证使用了哪个编译器,但是我的日志中没有路径或版本号,因此很失败。

This is a plain C (not C++, not MFC, not .NET) project written directly to the Win32Apis. 这是直接写入Win32Apis的普通C(不是C ++,不是MFC,不是.NET)项目。 Is there any way for this to work, or am I just stuck using a different compiler for a single project (out of over 100 that comprise the whole system)? 有什么办法可以解决这个问题,还是我只是为一个项目(在构成整个系统的100多个项目中)使用了不同的编译器?

HELP! 救命!

Have a look at Daffodil: http://daffodil.codeplex.com/ 看看水仙花: http : //daffodil.codeplex.com/

After installing Daffodil, you'll be able to use VS 2010 to build projects using older versions of the libraries. 安装Daffodil之后,您将能够使用VS 2010使用旧版本的库来构建项目。

I think I've solved it. 我想我已经解决了。 It seems that, while VS2010 will happily run the VS2008 compiler, linker, etc. VS2010 will NOT leave the project alone. 看起来,尽管VS2010可以愉快地运行VS2008编译器,链接器等。VS2010 不会将项目搁浅。 When the project is imported to VS2010 there are some new default settings added to the command line and, apparently, at least one of them is different enough from VS2008 to make the DLL I'm using fail to load. 当项目导入到VS2010时,命令行中添加了一些新的默认设置,显然,其中至少有一个与VS2008的差异足以使我正在使用的DLL无法加载。

When I changed the Advanced Linker setting for Data Execution Prevention (DEP) from Yes (the default) to NO, my program started working again! 当我将“ 数据执行保护(DEP)”的“高级链接器”设置从“是”(默认)更改为“否”时,我的程序再次开始工作! In fact, I no longer even need to compile using the v90 toolset -- the ENTIRE problem was caused by the new default for the /NXCOMPAT linker command line switch. 实际上,我什至不再需要使用v90工具集进行编译-整个问题是由/ NXCOMPAT链接器命令行开关的新默认设置引起的。 The /NXCOMPAT switch isn't even referenced in the project settings in the VS2005 IDE (where the project was created), but running "link /?" 在VS2005 IDE(创建项目的地方)的项目设置中甚至没有引用/ NXCOMPAT开关,而是运行“ link /?”。 in the VC8 bin folder shows that the switch was known and the default was NO . VC8 bin文件夹中的,表明该开关是已知的,默认值为NO

Too bad the Visual Studio IDE doesn't include a list of default settings that were in use by a project that have CHANGED in the new version. 不幸的是,Visual Studio IDE不包括已在新版本中更改过的项目所使用的默认设置的列表。 If that is too difficult, the importer should specify the changed settings using the old default values, otherwise the project was imported incorrectly, wasn't it? 如果那太困难了,导入者应该使用旧的默认值来指定更改的设置,否则项目导入不正确,不是吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM