我正在使用命名空间来保存我经常引用的常量变量,直到尝试编译程序,然后得到
C2653:“ ActivationSource”不是类或名称空间名称
和
C3861:'IdentitySource':找不到标识符
我的包含文件如下所示(请注意,我没有使用预编译的标头):
// includes.h
#pragma once
#include "pch.h"
#include <vector>
#include <iostream>
#include <string>
#include <functional>
#include <algorithm>
#include <utility>
#include "CustomTypes.h"
#include "ActivationSource.h"
#include "ThresholdSource.h"
#include "StaticVariables.h"
...
产生错误的文件看起来像这样
// StaticVariables.h
#pragma once
#include "includes.h"
namespace activations
{
const Activation Identity = ActivationSource::IdentitySource;
...
}
和ActivationSource.h看起来类似:
// ActivationSource.h
#pragma once
#include "includes.h"
namespace ActivationSource
{
float IdentitySource; // this is defined in ActivationSource.cpp
...
}
在此先感谢您,我不时对拼写的名字表示歉意。