【发布时间】:2018-07-12 17:27:45
【问题描述】:
使用此值列表:
char *icon[6] = {"icon0","icon1","icon2","icon3","icon4","icon5"};
char *ICON_FILE_PATH[6] = {"host0:img/200px/power-button-off.png","host0:img/200px/gamepad-console.png","host0:img/200px/dropbox-logo.png","host0:img/200px/open-folder.png","host0:img/200px/sitemap.png","host0:img/200px/settings.png"};
我需要得到那个:
#define ICON_FILE_PATH1 "host0:img/200px/power-button-off.png"
#define ICON_FILE_PATH2 "host0:img/200px/gamepad-console.png"
etc...
extern Orbis2dTexture *icon0;
extern Orbis2dTexture *icon0;
etc...
Orbis2dTexture *icon0 = NULL;
Orbis2dTexture *icon0 = NULL;
etc...
对于ICON_FILE_PATH 的每个值。
我的意思是使用:
for (int i=0; i<=5; i++ )
{
#define ?????
extern ?????
Orbis2dTexture ????
}
但我不知道怎么做...
【问题讨论】:
-
#define *char ICON_FILE_PATH"%s""ICON_FILE_PATH[i]"那部分没有意义 -
请解释
#define *char ICON_FILE_PATH"%s""ICON_FILE_PATH[i]"的思路 -
请在编译时启用警告。哇。我的意思是我不太确定这是如何编译的。
-
您好,欢迎来到 StackOverflow!我强烈建议您阅读此stackoverflow.com/help/how-to-ask,这样您的问题就不会被否决。提出具体问题,而不是要求人们修复您的代码。
-
这是我要求描述代码而不是显示代码的罕见情况。也许如果您用英语描述您想要实现的目标,我们可能会告诉您如何用 C 编写 tha。