【发布时间】:2017-05-02 17:21:59
【问题描述】:
我在这里做错了什么?
APP.h
#pragma once
namespace App{
enum class AppStatus{
Exit,
Menu,
Run
};
void frameLoop();
AppStatus state;
}
App.cpp
#include "App.h"
#include "stdafx.h"
#include <Graphic\Graphic.h>
void App::frameLoop()
{
while (state != AppStatus::Exit) {
Graphic::renderingSequence();
}
}
错误
Error C2653 'App': is not a class or namespace name App
Error C2065 'state': undeclared identifier App
Error C2653 'AppStatus': is not a class or namespace name App
Error C2065 'Exit': undeclared identifier App
请注意,我的命名空间 Graphic(在 \Graphic\Graphic.h 中声明)正在被编译器识别,即使我以相同的方式声明它。
【问题讨论】:
-
#include "stdafx.h"必须始终是第一个非注释行。上面的所有行都被编译器忽略。 -
这必须是重复的。
-
谢谢!将不得不更多地了解
#include <stdafx.h>的特别之处 -
@drescherjm 我没有找到任何对我有帮助的东西,因为我没想到#include 可以有可变功能
标签: c++ visual-c++ header namespaces stdafx.h