C++プログラミングの新機能です。私は様々な変数を保持するためにcppファイルを使用しています。私はここで何か間違っていると心配しています。私はいくつかの変数だけを保持する.cppファイルを持っています。初期化時に識別子が定義されていません
#include "Variables.h"
using namespace::std;
char ListItem[260] = "<Choose Location>";
string sqlDirectiveMessage = "";
int locationIndex = -1;
int selectionIndex = 0;
int dataGatheredFromIndex = 0;
SQLCHAR retconstring[1024];
とVariables.h
#pragma once
#include <Windows.h>
#include <sqlext.h>
#include <sql.h>
#include <vector>
#include <sqltypes.h>
#include <string>
using namespace::std;
extern char ListItem[];
extern string sqlDirectiveMessage;
extern int locationIndex;
extern int selectionIndex;
extern int dataGatheredFromIndex;
extern SQLCHAR retconstring[1024];
関連するコードのワンピース:この場合は、今
case IDC_ADD:
{
int test = 0;
HWND listbox = GetDlgItem(hwnd, IDC_LIST3);
selectionIndex = (int)SendMessage(listbox, LB_GETCURSEL, 0, 0);
dataGatheredFromIndex = (int)SendMessage(listbox, LB_GETITEMDATA, selectionIndex, 0);
}
break;
、私はいくつかの変数にVS 2017で監視を行う場合は、selectionIndexとlocationIndexは正常に動作するようですが、テストは未定義で、dataGatheredFromIndexもそうです。私は何か間違っていますか?
'test'はローカル変数です。最適化されている可能性があり、割り当ては不要です。最適化が有効になっている構成(AKAリリース構成)を使用していますか? – harper
あなたは正しいですが、私はリリース構成で稼働しています。 –
configをdebugに変更すると問題が解決されたようです。有難うございます。 –