我正在製作一個簡單的GUI庫,並且已經進行了第一次測試。奇怪的是,沒有一個窗口宏似乎被定義。我收到錯誤,如「'NULL'未在範圍內聲明」和「'HANDLE'未在範圍內聲明。」我認爲這可能是我組織代碼的方式,因爲入口文件easywin.hpp中的東西也沒有定義,但它像它應該工作的SEEMS。 easywin.hpp(大多數):Windows.h宏未定義
#ifndef EASYWIN_BASE_HPP
#define EASYWIN_BASE_HPP
#include <string>
#include <map>
//Strings are used everywhere, so might as well use them globally
using std::string;
/**
* A namespace to encapsulate WinAPI and prevent name clashing.
**/
namespace WinAPI{
#include <windows.h>
#include <commctrl.h>
}
//header includes (ordered according to inheritance)
#include "Application.hpp"
#include "Object.hpp"
#include "Widget.hpp"
#include "Container.hpp"
#include "Window.hpp"
#include "Dialog.hpp"
//not implemented yet, so don't include
//#include "Light.hpp"
#include "Heavy.hpp"
// there are more container types
#include "Control.hpp"
#include "Textbox.hpp"
#include "Tooltip.hpp"
//source includes
//needed to simplify class dependencies
#include "Application.cpp"
#include "Object.cpp"
#include "Widget.cpp"
#include "Container.cpp"
#include "Window.cpp"
#include "Dialog.cpp"
//not implemented yet, so don't include
//#include "Light.cpp"
#include "Heavy.cpp"
// there are more container types
#include "Control.cpp"
#include "Textbox.cpp"
#include "Tooltip.cpp"
#endif
我只是不明白。如果我在這個文件中包含所有內容,那麼這些文件應該得到這個文件中定義的內容。我做錯了什麼?
編輯:爲了鼓勵更好的答案,我會後git倉庫:
https://github.com/PiMaster/Easywin
下面兩個答案都沒有回答我的問題。我看不出任何會導致這種情況的原因。所有文件都包含在文件中,該文件包含/定義了包含/定義之後從未包含/定義的內容。有人知道爲什麼這不起作用!? – ConsciousCode