如何在代码中获取$(platform)变量 [英] How to get $(platform) variable in code

查看:74
本文介绍了如何在代码中获取$(platform)变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图根据构建配置放置项目名称。我想在编译时设置DLL的名称。

我在Visual Studio中为我的项目使用c ++ cli语言。

是否可以访问$ (平台)从代码变化?

如果是这样的话?

如果不是如何在编译时放入(x86位)或(x64位)。



我尝试过:



我尝试过使用环境。变量,但它总是放置64位,因为我的系统是64位。

我需要一个建议如何根据项目的配置来设置名称

解决方案

(平台)变量代码?

如果是这样的话?

如果不是如何在编译时放入(x86位)或(x64位)。



我的尝试:



我尝试过使用环境。变量,但它总是放置64位,因为我的系统是64位。

我需要一个建议如何根据项目配置来命名


有一些预定义的宏 [ ^ ]可用于检查项目是否为x86或x64平台构建:



  #ifdef _WIN64 
// 目标是64位ARM或x64
#else
// 定义_WIN32时,目标是32位
#endif


I am trying to put the name of project according to the build configuration . I wanted to set the name of the DLL on compile time.
I am using c++cli Language for my project in Visual studio.
Is it possible to access $(platform) varible from the code ?
If so how ?
If not how to put the (x86 bit) or (x64 bit) at compile time.

What I have tried:

I have tried using environment. variable but it always place 64 bit because my system is 64 bit.
I need a suggestion how to place name according to configuration of project

解决方案

(platform) varible from the code ?
If so how ?
If not how to put the (x86 bit) or (x64 bit) at compile time.

What I have tried:

I have tried using environment. variable but it always place 64 bit because my system is 64 bit.
I need a suggestion how to place name according to configuration of project


There are some Predefined Macros[^] that can be used to check if the project is build for x86 or x64 platforms:

#ifdef _WIN64
// Target is 64-bit ARM or x64
#else
// Target is 32-bit when _WIN32 is defined
#endif


这篇关于如何在代码中获取$(platform)变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆