C++文件中的$include,以及代码中的其他$值

$include in a C++ file, and other $ values in the code

本文关键字:代码 其他 include 文件 C++      更新时间:2023-10-16

我最近收到了大量遗留C++代码,我想将其转移到最新的VS2012编译器或GCC编译器中。

然而,当我查看一些文件时,我可以看到一些以$符号为前缀的代码

例如,我有一些包含行:

#include "utlString.h"
$include "gclFloat_c.h"

和枚举声明:

$enum gclEFormatType
{
    StandardFormat = 0,         // e.g. 192784.272674700000000000
    ScientificFormat = 1,       // e.g. 1.927842726747E5          (includes exponent)
    ExtendedFormat = 2          // e.g. 1.927842726747E5S30       (includes exponent and significant digit count)
};

我还有一些其他声明:

$cointerface [dual] gclIFloat : IDispatch 
{
  ...
}
$coclass [STA] gclCFloat;

我认为它们可能是预处理器宏,但我不确定。有人能告诉我有什么吗?它们是如何使用的?

感谢

有三种可能性:

  • 代码在被提供给编译器之前通过一些外部预处理器运行
  • 它是编译器特定的扩展(请查看编译器的文档);或
  • 这是一个语法错误

看起来这些文件是用来为c++和脚本包装器(如swig)生成包含文件的,但[dual]和[sta]让我认为它的目标是将c#作为第二语言。

很可能是Visual Studio的nmake语法。

你可以在互联网上找到很多关于这方面的教程,美元符号也被用作具有Visual Studio特定语法的令牌的标识符(在nmake之外)。

相关文章: