【发布时间】:2013-07-28 07:12:49
【问题描述】:
在input.h 我这样定义eventFunctions:
multimap <Uint8, function<void(SDL_Event&)>> eventFunctions;
Input.h 被包围:
#ifndef INPUT_H
#define INPUT_H
//code
#endif
但是,在编译时我得到了这个:multiple definition of eventFunctions
引用包含input.h 的每个文件。
我还将它添加到 input.h 以查看在编译期间它被处理了多少次:#warning "entered input_h" 警告打印了几次(每次包含它),表明它被处理了多次,尽管包含保护。
我做错了什么?
【问题讨论】: