VS 的编译选项 build下的 platform target -- Any CPU和x86有什么影响?

本文解释了VS编译选项中AnyCPU与x86的区别,特别是对于需要调用32位库的应用程序,在不同位数的操作系统上的表现差异。同时介绍了MixedPlatform与AnyCPU的区别。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

VS 的编译选项 build下的 platform target -- Any CPU和x86有什么影响?

VS 的编译选项 build下的platform -- Any CPU和x86有什么影响?

现在的问题是,我的一个assembly用Any CPU编译就不能在64位系统下运行了,但是用x86编译就ok

 

原因是如果用Any CPU编译,那么在64位机器默认的运行就是64位的,

而我的assembly需要调用一个32的COM库,所以就运行不起来

只要用x86编译,那么程序就是以32位的程序,依靠wow64来运行的,所以就ok

 

所以,如果assembly需要使用win32库的话,

那么编译选项就不能使用默认的Any CPU了需要注意
 
我去,ANY CPU的意思不是任何CPU都可以用,而是当前编译的这台机子的环境可用
 
 
大家可再了解一下
Mixed Platform vs Any CPU
 
 Team Build deals with solution configurations - these are the platforms (e.g. .NET or Win32) and configurations (e.g. Debug or Release) you typically see in combo boxes within Visual Studio when you have a solution loaded (if you hover over these boxes the tooltips will say "Solution Platforms" and "Solution Configurations", respectively).  When all of the projects in a solution are of the same type (e.g. C#/VB projects) the solution configurations will match up exactly with the project configurations.  Once you have projects in a solution that have mismatched configurations/platforms, Visual Studio creates the solution level configuration(s) "Mixed Platforms/Debug" and possibly "Mixed Platforms/Release".  These configurations are just mappings to individual project level configurations.

      For example, if you have a C# project and a C++ project, typically "Mixed Platforms/Debug" will map to "Any CPU/Debug" for the C# project and "Win32/Debug" for the C++ project.  

      To see these mappings, open up the Configuration Manager (either through the Build menu or by clicking on the platform or configuration combo box and selecting Configuration Manager...).  You should see combo boxes for the Active solution configuration and the Active solution platform and then a table showing you the project level mappings.  This will show you the platform generated for each project under each solution configuration.
 

posted on 2016-07-02 14:37 jiahuafu 阅读(...) 评论(...) 编辑 收藏

Succeed: Total num: 1242, size: 19,210,497. OK num: 1242(download 1242 objects). general-app-build-cd4x7-app-build-3922681543:  general-app-build-cd4x7-app-build-3922681543: average speed 2408000(byte/s) general-app-build-cd4x7-app-build-3922681543:  general-app-build-cd4x7-app-build-3922681543: 7.978701(s) elapsed general-app-build-cd4x7-app-build-3922681543: ossutil command executed successfully. general-app-build-cd4x7-app-build-3922681543: PLATFORM_TYPE:orin general-app-build-cd4x7-app-build-3922681543: DOCKER_IMAGE_VER:dev-x86-5.2.4 general-app-build-cd4x7-app-build-3922681543: Extracting Bazel installation... general-app-build-cd4x7-app-build-3922681543: Starting local Bazel server and connecting to it... general-app-build-cd4x7-app-build-3922681543: (03:18:29) WARNING: The following configs were expanded more than once: [orin3_config, orin_config]. For repeatable flags, repeats are counted twice and may lead to unexpected behavior. general-app-build-cd4x7-app-build-3922681543: (03:18:29) INFO: Invocation ID: 1e564be4-df8a-403c-ba96-26877659eb7f general-app-build-cd4x7-app-build-3922681543: (03:18:30) INFO: Current date is 2025-07-24 general-app-build-cd4x7-app-build-3922681543: (03:18:30) Loading:  general-app-build-cd4x7-app-build-3922681543: (03:18:30) Loading: 0 packages loaded general-app-build-cd4x7-app-build-3922681543: (03:18:30) Analyzing: target //:adas_active_noa_package (1 packages loaded, 0 targets configured) general-app-build-cd4x7-app-build-3922681543: (03:18:31) DEBUG: /apollo/modules/active_safety/BUILD:76:6: "cpu_arch: " + select({"x86_mode": "x86_64", "arm_mode": "aarch64", "arm_j6m_mode": "aarch64_j6m"}) general-app-build-cd4x7-app-build-3922681543: (03:18:31) ERROR: /apollo/modules/mpc/mpc_drv_ctap_fusion_lane/BUILD:149:8: no such package 'modules/mpc/mpc_drv_ctap_fusion_lane/src': BUILD file not found in any of the following directories. Add a BUILD file to a directory to mark it as a package. general-app-build-cd4x7-app-build-3922681543: - /apollo/modules/mpc/mpc_drv_ctap_fusion_lane/src and referenced by '//modules/mpc/mpc_drv_ctap_fusion_lane:libs' general-app-build-cd4x7-app-build-3922681543: (03:18:31) ERROR: Analysis of target '//:adas_active_noa_package' failed; build aborted: Analysis failed general-app-build-cd4x7-app-build-3922681543: (03:18:31) INFO: Elapsed time: 3.452s general-app-build-cd4x7-app-build-3922681543: (03:18:31) INFO: 0 processes. general-app-build-cd4x7-app-build-3922681543: (03:18:31) FAILED: Build did NOT complete successfully (131 packages loaded, 503 targets configured) general-app-build-cd4x7-app-build-3922681543: (03:18:31) FAILED: Build did NOT complete successfully (131 packages loaded, 503 targets configured) general-app-build-cd4x7-app-build-3922681543: time="2025-07-24T03:18:32.484Z" level=info msg="sub-process exited" argo=true error="<nil>" general-app-build-cd4x7-app-build-3922681543: time="2025-07-24T03:18:32.484Z" level=info msg="no need to save parameter - on overlapping volume: /apollo/build_manifest_base64" argo=true general-app-build-cd4x7-app-build-3922681543: time="2025-07-24T03:18:32.484Z" level=info msg="no need to save parameter - on overlapping volume: /apollo/compile_parameter" argo=true general-app-build-cd4x7-app-build-3922681543: time="2025-07-24T03:18:32.484Z" level=info msg="no need to save parameter - on overlapping volume: /apollo/app_oss_path" argo=true general-app-build-cd4x7-app-build-3922681543: Error: exit status 1编译错误
最新发布
07-25
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

银狐游戏开发资源2

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值