首页 > 解决方案 > “ActivationsSource”不是类或命名空间名称

问题描述

我正在使用命名空间来保存我经常引用的常量变量,在我尝试编译程序之前似乎没有任何问题,然后我得到

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
    ...
}

在此先感谢,我很抱歉可能不时拼写不同的名字。

标签: c++visual-c++scopecompilationnamespaces

解决方案


推荐阅读