计算#include指令问题 [英] computed #include directives questiron

查看:67
本文介绍了计算#include指令问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一堆条件#include语句,比如


#if PLATFORM ==" LINUX"

#include" LinuxImplementation.h"

#elif PLATFORM ==" WINDOWS"

#include" WindowsImplementation.h"

#elif PLATFORM ==" MACINTOSH"

#include" MacintoshImplementation.h"

#endif


我有什么方法可以使用标准预处理器功能将

转换为单个#include stmt,如


#include< PLATFORM" Implementation.h">


其中''PLATFORM''在Implementation.h之前连接在一起?


我在微软的VC7预处理器上的实验还没有/>
到目前为止成功。

谢谢!


I have a bunch of conditional #include statements like

#if PLATFORM == "LINUX"
#include "LinuxImplementation.h"
#elif PLATFORM ==" WINDOWS"
#include "WindowsImplementation.h"
#elif PLATFORM ==" MACINTOSH"
#include "MacintoshImplementation.h"
#endif

Is there some way I can use the standard preprocessor functionality to
transform this into a single #include stmt like

#include <PLATFORM "Implementation.h">

where ''PLATFORM'' gets concatenated in front of "Implementation.h"?

My experiments with Microsoft''s VC7 preprocessor have not been
successful so far.
Thanks!

推荐答案

James写道:
我有一堆条件#include语句,如

#if PLATFORM ==" LINUX"
#include" LinuxImplementation.h"
# elif PLATFORM ==" WINDOWS"
#include" WindowsImplementation.h"
#elif PLATFORM ==" MACINTOSH"
#include" MacintoshImplementation.h"
#endif

是否有某些方法可以使用标准预处理器功能将其转换为单个#包括stmt,如

#include< PLATFORM" Implementation.h">

其中''PLATFORM''在Implementation.h前面连​​接起来?

到目前为止,我使用微软VC7预处理器的实验还没有成功。
I have a bunch of conditional #include statements like

#if PLATFORM == "LINUX"
#include "LinuxImplementation.h"
#elif PLATFORM ==" WINDOWS"
#include "WindowsImplementation.h"
#elif PLATFORM ==" MACINTOSH"
#include "MacintoshImplementation.h"
#endif

Is there some way I can use the standard preprocessor functionality to
transform this into a single #include stmt like

#include <PLATFORM "Implementation.h">

where ''PLATFORM'' gets concatenated in front of "Implementation.h"?

My experiments with Microsoft''s VC7 preprocessor have not been
successful so far.




提供一个命令行宏类似于


-DPLATFORMIMPL2INCLUDE =" \" LinuxImplementation.h \""


在Linux上和


-DPLATFORMIMPL2INCLUDE =" \" WindowsImplementation.h \"


在Windows上(依此类推),然后执行


#include PLATFORMIMPL2INCLUDE

$ b你的代码中有$ b。


V

-

请通过邮件回复时从我的地址删除资金



Provide a command-line macro that would be different on different
platforms similar to

-DPLATFORMIMPL2INCLUDE="\"LinuxImplementation.h\""

on Linux and

-DPLATFORMIMPL2INCLUDE="\"WindowsImplementation.h\" "

on Windows (and so on), and then do

#include PLATFORMIMPL2INCLUDE

in your code.

V
--
Please remove capital As from my address when replying by mail


Victor Bazarov写道:
Victor Bazarov wrote:
James写道:
我有一堆条件#include语句,如

#if PLATFORM ==" LINUX"
#include" LinuxImplementation.h"
#elif PLATFORM ==" WINDOWS"
#include" WindowsImplementation.h"
#elif PLATFORM ==" MACINTOSH"
#include" MacintoshImplementation.h"
#endif

是否有某些方法可以使用标准预处理器功能将其转换为单个#包括stmt,如

#include< PLATFORM" Implementation.h">

其中''PLATFORM''在Implementation.h前面连​​接起来?

到目前为止,我对微软VC7预处理器的实验还没有成功。
I have a bunch of conditional #include statements like

#if PLATFORM == "LINUX"
#include "LinuxImplementation.h"
#elif PLATFORM ==" WINDOWS"
#include "WindowsImplementation.h"
#elif PLATFORM ==" MACINTOSH"
#include "MacintoshImplementation.h"
#endif

Is there some way I can use the standard preprocessor functionality to
transform this into a single #include stmt like

#include <PLATFORM "Implementation.h">

where ''PLATFORM'' gets concatenated in front of "Implementation.h"?

My experiments with Microsoft''s VC7 preprocessor have not been
successful so far.



提供一个不同的命令行宏在Linux和
上类似于不同的平台--DPLATFORMIMPL2INCLUDE =" \" LinuxImplementation.h \""


-DPLATFORMIMPL2INCLUDE =" \" WindowsImplementation.h \" 在Windows上等等,然后再做

#include PLATFORMIMPL2INCLUDE



Provide a command-line macro that would be different on different
platforms similar to

-DPLATFORMIMPL2INCLUDE="\"LinuxImplementation.h\""

on Linux and

-DPLATFORMIMPL2INCLUDE="\"WindowsImplementation.h\" "

on Windows (and so on), and then do

#include PLATFORMIMPL2INCLUDE




无法'他做的事情如下:


#define HEADER_FILE_NAME PLATFORM" Implementation.h"

#include HEADER_FILE_NAME



Couldn''t he do something like:

#define HEADER_FILE_NAME PLATFORM "Implementation.h"
#include HEADER_FILE_NAME


red floyd写道:
red floyd wrote:
Victor Bazarov写道:
Victor Bazarov wrote:
James写道:
我有一堆条件#include语句如

#if PLATFORM ==" LINUX"
#include" LinuxImplementation.h"
#elif PLATFORM ==" WINDOWS"
#include" WindowsImplementation.h"
#elif PLATFORM ==" MACINTOSH"
#include" MacintoshImplementation.h"
#endif

是否有某些方法可以使用标准的预处理器功能将其转换为单个#包括stmt,如

#include< PLATFORM" Implementation.h">

其中''PLATFORM''在Implementation.h前面连​​接起来?

到目前为止,我对微软VC7预处理器的实验还没有成功。
I have a bunch of conditional #include statements like

#if PLATFORM == "LINUX"
#include "LinuxImplementation.h"
#elif PLATFORM ==" WINDOWS"
#include "WindowsImplementation.h"
#elif PLATFORM ==" MACINTOSH"
#include "MacintoshImplementation.h"
#endif

Is there some way I can use the standard preprocessor functionality
to transform this into a single #include stmt like

#include <PLATFORM "Implementation.h">

where ''PLATFORM'' gets concatenated in front of "Implementation.h"?

My experiments with Microsoft''s VC7 preprocessor have not been
successful so far.



提供一个不同的命令行宏在Linux和
上类似于不同的平台--DPLATFORMIMPL2INCLUDE =" \" LinuxImplementation.h \""


-DPLATFORMIMPL2INCLUDE =" \" WindowsImplementation.h \" Windows上的

(依此类推),然后做

#include PLATFORMIMPL2INCLUDE



Provide a command-line macro that would be different on different
platforms similar to

-DPLATFORMIMPL2INCLUDE="\"LinuxImplementation.h\""

on Linux and

-DPLATFORMIMPL2INCLUDE="\"WindowsImplementation.h\" "

on Windows (and so on), and then do

#include PLATFORMIMPL2INCLUDE



他不能做类似于:

#define HEADER_FILE_NAME PLATFORM" Implementation.h"
#include HEADER_FILE_NAME



Couldn''t he do something like:

#define HEADER_FILE_NAME PLATFORM "Implementation.h"
#include HEADER_FILE_NAME




我不觉得所以。但请尝试一下,如果你成功了,请告诉我们。


V

-

请删除资金来自通过邮件回复我的地址



I don''t think so. But do try it, and if you succeed, let us know.

V
--
Please remove capital As from my address when replying by mail


这篇关于计算#include指令问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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