关于预处理器和xlw的基本问题 [英] Elementary question on preprocessors and xlw

查看:68
本文介绍了关于预处理器和xlw的基本问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用xlw包作为excel函数的c ++包装器。在

我们的c ++库中,有一个excel函数,我们的c ++开发人员将b $ b称为DevelopersFunction,而excel用户称之为

ExcelFunction。 [功能名称已更改为保留公司

机密性]


有些代码包含字符串DevelopersFunction和

导致excel用户在excel中使用insert_function命令时看到文本DevelopersFunction。


但是excel用户应该看到ExcelFunction


我想这可以通过简单的预处理器#define

命令完成。

我试图在excel中将函数重命名为ExcelFunction然后

#define DevelopersFunction ExcelFunction


但这似乎不起作用。


任何建议。


谢谢,


Paul Epstein

I am using the xlw package as a c++ wrapper for excel functions. In
our c++ library, there is an excel function which our c++ developers
refer to as DevelopersFunction, and which the excel users refer to as
ExcelFunction. [Names of functions changed to preserve corporate
confidentiality]

There is some code containing the string "DevelopersFunction" which
results in the excel users seeing the text DevelopersFunction when
they use the insert_function command in excel.

But the excel users should see "ExcelFunction"

I would imagine that this can be done by a simple preprocessor #define
command.
I tried to rename the function to ExcelFunction in excel and then
#define DevelopersFunction ExcelFunction

But this doesn''t appear to work.

Any suggestions.

Thanks,

Paul Epstein

推荐答案

10月4日晚上7:45,pauldepst ... @ att.net写道:
On Oct 4, 7:45 pm, pauldepst...@att.net wrote:

我使用xlw包作为excel函数的c ++包装器。在

我们的c ++库中,有一个excel函数,我们的c ++开发人员将b $ b称为DevelopersFunction,而excel用户称之为

ExcelFunction。 [功能名称已更改为保留公司

机密性]


有些代码包含字符串DevelopersFunction和

导致excel用户在excel中使用insert_function命令时看到文本DevelopersFunction。


但是excel用户应该看到ExcelFunction


我想这可以通过简单的预处理器#define

命令完成。

我试图在excel中将函数重命名为ExcelFunction然后

#define DevelopersFunction ExcelFunction


但这似乎不起作用。


任何建议。
I am using the xlw package as a c++ wrapper for excel functions. In
our c++ library, there is an excel function which our c++ developers
refer to as DevelopersFunction, and which the excel users refer to as
ExcelFunction. [Names of functions changed to preserve corporate
confidentiality]

There is some code containing the string "DevelopersFunction" which
results in the excel users seeing the text DevelopersFunction when
they use the insert_function command in excel.

But the excel users should see "ExcelFunction"

I would imagine that this can be done by a simple preprocessor #define
command.
I tried to rename the function to ExcelFunction in excel and then
#define DevelopersFunction ExcelFunction

But this doesn''t appear to work.

Any suggestions.



说实话,我不能按照你的描述来解决这个问题,我也不知道有什么问题。 ;包

(至少不在C ++环境中)。


也许你可以看一下''typedef''?


请尽量多一点清楚,有人

其他也许可以帮到你。


-

Chris Val


To be honest, I can''t follow your description of
the problem, and I don''t know of any "packages"
(at least not in a the C++ context).

Maybe you can look at using a ''typedef''?

Please try to be a little more clear and someone
else might be able to help you.

--
Chris Val




10月4日晚上7:05,Chris(Val )" < chris ... @ gmail.comwrote:
On Oct 4, 7:05 pm, "Chris ( Val )" <chris...@gmail.comwrote:

10月4日晚上7:45,pauldepst ... @ att.net写道:


On Oct 4, 7:45 pm, pauldepst...@att.net wrote:



我使用xlw包作为excel函数的c ++包装器。在

我们的c ++库中,有一个excel函数,我们的c ++开发人员将b $ b称为DevelopersFunction,而excel用户称之为

ExcelFunction。 [函数名称已更改为保留公司

机密性]
I am using the xlw package as a c++ wrapper for excel functions. In
our c++ library, there is an excel function which our c++ developers
refer to as DevelopersFunction, and which the excel users refer to as
ExcelFunction. [Names of functions changed to preserve corporate
confidentiality]


有些代码包含字符串DevelopersFunction和

导致excel用户在使用excel中的insert_function命令时看到文本DevelopersFunction。
There is some code containing the string "DevelopersFunction" which
results in the excel users seeing the text DevelopersFunction when
they use the insert_function command in excel.


但是excel用户应该看到ExcelFunction
But the excel users should see "ExcelFunction"


我想这可以通过简单的预处理器#define

命令完成。

我试图在Excel中将函数重命名为ExcelFunction然后

#define DevelopersFunction ExcelFunction
I would imagine that this can be done by a simple preprocessor #define
command.
I tried to rename the function to ExcelFunction in excel and then
#define DevelopersFunction ExcelFunction


但这不是'似乎工作。
But this doesn''t appear to work.


任何建议。
Any suggestions.



说实话,我不能按照你的描述来解决这个问题,我也不知道有什么问题。 ;包

(至少不在C ++环境中)。


也许你可以看一下''typedef''?


请尽量多一点清楚,有人

其他也许可以帮到你。


- < br $>
Chris Val-隐藏引用文字 -


- 显示引用文字 -


To be honest, I can''t follow your description of
the problem, and I don''t know of any "packages"
(at least not in a the C++ context).

Maybe you can look at using a ''typedef''?

Please try to be a little more clear and someone
else might be able to help you.

--
Chris Val- Hide quoted text -

- Show quoted text -



谢谢。


我找到了一种澄清问题的方法,现在我明白了

我自己的问题更好


我有一个名为MyConstructor的构造函数,它带有一个const

std :: string&参数。


我希望预处理器将MyConstructor(dog)翻译成

MyConstructor(cat)。


这看起来像#define问题而不是typedef问题。


再次感谢,


Paul Epstein

Thanks.

I have found a way of clarifying the problem, now that I understand
the issue better myself

I have a constructor called MyConstructor which takes a const
std::string & parameter.

I want the preprocessor to translate MyConstructor("dog") into
MyConstructor("cat").

This seems like a #define problem rather than a typedef problem.

Thanks again,

Paul Epstein


10月4日晚上9:23,pauldepst ... @ att.net写道:
On Oct 4, 9:23 pm, pauldepst...@att.net wrote:

10月4日下午7:05,Chris(Val) < chris ... @ gmail.comwrote:

On Oct 4, 7:05 pm, "Chris ( Val )" <chris...@gmail.comwrote:



10月4日晚上7:45,pauldepst ... @ att .net写道:
On Oct 4, 7:45 pm, pauldepst...@att.net wrote:


我使用xlw包作为excel函数的c ++包装器。在

我们的c ++库中,有一个excel函数,我们的c ++开发人员将b $ b称为DevelopersFunction,而excel用户称之为

ExcelFunction。 [函数名称已更改为保留公司

机密性]
I am using the xlw package as a c++ wrapper for excel functions. In
our c++ library, there is an excel function which our c++ developers
refer to as DevelopersFunction, and which the excel users refer to as
ExcelFunction. [Names of functions changed to preserve corporate
confidentiality]


有一些代码包含字符串DevelopersFunction和

导致excel用户在使用excel中的insert_function命令时看到文本DevelopersFunction。
There is some code containing the string "DevelopersFunction" which
results in the excel users seeing the text DevelopersFunction when
they use the insert_function command in excel.


但是excel用户应该看到ExcelFunction
But the excel users should see "ExcelFunction"


我想这可以通过一个简单的预处理器完成#define

命令。

我试图在Excel中将函数重命名为ExcelFunction然后

#define DevelopersFunction ExcelFunction
I would imagine that this can be done by a simple preprocessor #define
command.
I tried to rename the function to ExcelFunction in excel and then
#define DevelopersFunction ExcelFunction


但这似乎不起作用。
But this doesn''t appear to work.


任何建议。
Any suggestions.


说实话,我不能按照你的描述来解决这个问题,而我不知道任何包

(至少不是在C ++上下文中)。
To be honest, I can''t follow your description of
the problem, and I don''t know of any "packages"
(at least not in a the C++ context).


也许你可以看一下使用''typedef''?
Maybe you can look at using a ''typedef''?


请尝试更清楚一点,有人

其他人可能会帮助你。
Please try to be a little more clear and someone
else might be able to help you.


-

Chris Val-隐藏引用文字 -
--
Chris Val- Hide quoted text -


- 显示引用文字 -
- Show quoted text -



谢谢。


我找到了一种方法来澄清问题,现在我明白了

这个问题更好我自己


Thanks.

I have found a way of clarifying the problem, now that I understand
the issue better myself



好​​:-)

Good :-)


我有一个名为MyConstructor的构造函数,它带有一个const

std :: string&参数。


我希望预处理器将MyConstructor(dog)翻译成

MyConstructor(cat)。


这看起来像#define问题而不是typedef问题。


再次感谢,
I have a constructor called MyConstructor which takes a const
std::string & parameter.

I want the preprocessor to translate MyConstructor("dog") into
MyConstructor("cat").

This seems like a #define problem rather than a typedef problem.

Thanks again,



#include< iostream>

#include< string>


struct Foo

{

Foo(const std :: string& s);

};


//尝试使用和不使用此功能(注释掉)...

#define DevelopersFunction" DevelopersFunction"

#如果定义了DevelopersFunction

Foo :: Foo(const std :: string& s) {

std :: cout<< s<< "来自:DevelopersFunction \ n";

}

#else

Foo :: Foo(const std :: string& s){

std :: cout<< s<< "来自:ExcelFunction \ n";

}

#endif

int main()

{

Foo(arg);


std :: cin.get();

返回0;

}


他有帮助吗?


-

Chris val

# include <iostream>
# include <string>

struct Foo
{
Foo( const std::string& s );
};

// Try with and without this (comment out)...
#define DevelopersFunction "DevelopersFunction"

# if defined DevelopersFunction
Foo::Foo( const std::string& s ) {
std::cout << s << " from: DevelopersFunction\n";
}
#else
Foo::Foo( const std::string& s ) {
std::cout << s << " from: ExcelFunction\n";
}
#endif
int main()
{
Foo( "arg" );

std::cin.get();
return 0;
}

Does his help?

--
Chris val


这篇关于关于预处理器和xlw的基本问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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