好吧所以我很累,否则我会深思熟虑地查找这个问题,(我的意思是我有一点点,但我找不到任何东西)
我试图在我的struct static中创建所有变量,因为它需要保留所有值以在另一个函数中进行求值。
(我将发布相关代码的片段) 这是我的代码,希望你能告诉我这是怎么回事:
错误: 未解析的外部符号“public:static wchar_t * gameLaunch :: directory”
未解析的外部符号“public:static wchar_t * gameLaunch :: AppName”
未解析的外部符号“public:static wchar_t * gameLaunch :: ComboBoxName”
# Keep the last copy with a given link but order not preserved in result
kept_last = {x.link: x for x in nonuniquelist}.values()
# Keep the first copy with a given link but order not preserved in result
kept_first = {x.link: x for x in reversed(nonuniquelist)}.values()
struct gameLaunch
{
int ID = 0;
static wchar_t directory[MAX_PATH];
static wchar_t AppName[MAX_PATH];
static wchar_t ComboBoxName[MAX_PATH];
}gameLaunchtest;
gameLaunch test[100];
gameLaunch gameLaunchtest;
case IDB_CLICK_ME:
{
GetWindowText(hProgramDirectory, gameLaunchtest.directory, MAX_PATH);
GetWindowText(hProgramName, gameLaunchtest.AppName, MAX_PATH);
GetWindowText(hProgramNameComboBox, gameLaunchtest.ComboBoxName, MAX_PATH);
wofstream launchLocations;
launchLocations.open("LaunchLocations.txt", std::ios_base::app | std::ios_base::out);
launchLocations << gameLaunchtest.directory << endl;
launchLocations << gameLaunchtest.AppName << endl;
launchLocations << gameLaunchtest.ComboBoxName << endl;
ComboBox_AddString(comboBox, gameLaunchtest.directory);
launchLocations.close();
break;
答案 0 :(得分:0)
您需要声明类/结构之外的静态字段。它应该以下列方式完成:
wchar_t gameLaunch::directory[MAXPATH];
wchar_t gameLaunch::AppName[MAXPATH];
wchar_t gameLaunch::ComboBoxName[MAXPATH];