私は今約30分間グーグルで検索しましたが、私の問題に関連するものは何も見つかりませんでした:
私はVisual Studio C++ 2008を使用しています。このヘッダーで「stdafx.h」というヘッダーを宣言しました。必要なものをすべて宣言しました。グローバル変数もそこに入れたいのですが、これらのいずれかを使用したい場合変数、私は(コンパイル時に)エラーが発生します私の「stdafx.h」は次のようになります:
#pragma once
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files:
windows header here....
// C RunTime Header Files
compiler related standard headers here....
// TODO: reference additional headers your program requires here
#ifndef aaab
#include "codename.hpp"
#define aaab
#endif
// and a load of other headers (all of my project) followed here
...
...
...
宣言の後、次のようにグローバルを定義しました。
Game *game;
「codename.cpp」でそれらを使用したい
ここにクラスの簡単なビューがあります
#include "stdafx.h"
#define MAX_LOADSTRING 100
other class related stuff here....
main function here....
void test()
{
game = new Game(); // HERE IS THE ERROR
}