gpt4 book ai didi

c++ - 使用 Borland C++ 编译器(5.5 版)的问题

转载 作者:塔克拉玛干 更新时间:2023-11-03 06:59:00 25 4
gpt4 key购买 nike

声明:

namespace a {
namespace b {
class Classe {
public:
Classe();
};
}
}

定义:

#include "sample.h"

namespace a {
b::Classe::Classe(){}
}

但是根据这个定义我得到了这个错误:

Error E2038 .\sample.cpp 4: Cannot declare or define 'b::Classe::Classe()' here

将源更改为:

#include "sample.h"

namespace a {
namespace b {
Classe::Classe(){}
}
}

如何在不更改整个代码的情况下进行编译?

这不是我的选择。其实我是一个Linux环境下的开发者,从来没有想过自己会再在Windows上开发。它适用于仅使用 Borland C++ 编译器的特定客户。

我找到了 this wiki page来自内河码头。没什么用。


我放弃了。我正在按照雷米所说的去做。

最佳答案

尝试删除 .cpp 文件中的命名空间 block ,并只限定整个构造函数:

#include "sample.h"

a::b::Classe::Classe(){}

关于c++ - 使用 Borland C++ 编译器(5.5 版)的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5305460/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com