这似乎很简单,但我无法弄清楚。这是一个问题:我有一个返回字符串的简单函数:
const wchar_t* getCompanyName() { return L"Test Company";};
我想定义如下宏:
#define COMPANY getCompanyName();
#define PRODUCT COMPANY L" in Canada"
const wchar_t * company = COMPANY;
const wchar_t * product = PRODUCT;
我希望看到“产品”值是“加拿大测试公司”,但它只显示“测试公司”和字符串“加拿大”从不连接到产品字符串
非常感谢您抽出宝贵的时间,这是完整的代码:
#include <stdio.h>
#include <tchar.h>
const wchar_t* getCompanyName() { return L"Test Company";};
#define COMPANY getCompanyName();
#define PRODUCT COMPANY L" in Canada"
int _tmain(int argc, _TCHAR* argv[]) {
const wchar_t * company = COMPANY; // get Test Company
const wchar_t * place = PRODUCT; // get Test Company in Canada
wprintf(company);
wprintf(place);
return 0;
}