问题标签 [duplicate-symbol]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c++ - 在新项目中包含头库会显示重复的“constexpr”错误
我有两个独立的项目。第一个项目使用 range-v3 仅标头库,我也想在我的新项目中使用范围库,但包含该库会显示重复constexpr
错误。我的第一个项目中没有duplicate error
。
总之:
为什么我的编译器duplicate symbol error
在一个全新的项目中使用范围库时会抛出该消息,我该如何解决这个问题?
CLion 2019.3(项目启用 C++20 选项)
海合会 9.2
ericniebler 的 range-v3 库
我的主要:
在我的旧项目中工作的 CMake 代码:
我的编译器抛出的错误消息:
已解决:我的旧 CMake 有一个我忘记使用的特定编译器选项(见答案)。
ios - Flutter 项目无法在 iOS 模拟器上构建(重复符号错误)
每当我尝试在 iOS 模拟器上构建我的颤振项目时,我都会收到此错误。有时它在从 ios 文件夹中删除 Podfiles 后工作得很好,并且还在终端中使用“flutter pub cache repair”和“flutter clean”命令。我似乎无法找出问题并找到永久解决方案。
xcode - Pods(Flipper)和外部库中的重复符号
我知道关于这个问题有很多问题,但我没有想出解决方案。我们在我的项目(react-native)中有一个静态库:我们称它为externalLib_v1.1r.a
我们手动添加到我的项目中的。它总是工作得很好。这是一个安全库,我们无法访问源代码。使用带有最新版本的 react-native 的新版本 Flipper,我在使用 Xcode 构建时遇到以下问题:
有 2 个externalLib_v1.1r.a
同名方法(1 个在 ConnectionContextStore.cpp (Flipper) 内部,1 个在内部)。
如果我手动重命名fileExists
Flipper Pod 内的方法,一切正常......有没有办法避免这种解决方法?
注意:我的项目的“其他链接器标志”中有 -ObjC 标志。
reactjs - v-for 在反应中的等价物是什么?
在 vue 中,我可以多次复制一个 svg 文件,例如 v-for="i in 5":key="i"。我怎样才能在 React 中做到这一点?
c++ - 从哪里开始使用“重复符号”进行故障排除?
我正在 Mac 上学习 C++,并尝试遵循 SFML Game Development by Example 一书。当我得到任何明显的开始寻找问题的地方:
? 这与#include有什么关系吗?
这是我的 make 命令:
所有列出的重复符号都来自 make 命令中 cpps 列表中的第一个文件,与其他各种 cpp 文件配对...
c++ - 在我的 C++ 代码中的多个标题中包含一个标题
我正在尝试在我的代码中包含来自《数字食谱》一书的头文件。我必须包含的头文件是 nr3.hpp 和 interp_1d.hpp。interp_1d
需要定义nr3
才能工作。
我将编写一些出现在 interp_1d.hpp 上的代码,以便您了解我正在处理 interp_1d 代码的内容:
此头文件中没有标头保护。结果,当我尝试在多个其他头文件中输入它时,我收到错误“66 个重复符号用于架构 x86_64”。
我的代码结构如下:
我不知道如何克服这个问题。我希望能够在不止一部分代码中使用 interp_1d.hpp 函数。我尝试包括头守卫,但这不起作用:
有谁知道我如何在多个其他标头中使用 interp_1d 标头而不会发生此错误?
c++ - Symbols already defined with C++ templates used by static and shared libraries
I have the following problem in my project that contains several modules (I am sorry but I could not find a simpler example) :
- Module1 defines a full template class ILocatable
- Module2 defines a class Component
- Module3 defines a class LocatableEntity that inherits from ILocatable < MyVector3D> (here, MyVector3D is an std::array<double,3>)
- Module4a uses modules 1,2,3, and defines a class LocatableComponent4a which inherits from Component and ILocatable < MyVector3D > that uses LocatableEntity
- Module4b uses modules 1,2,3,4a, a defines a class LocatableComponent4b which inherits from Component and ILocatable < MyVector3D > and uses LocatableComponent4a and LocatableEntity
Module1 and Module3 are static libraries. Module2, Module4a, Module4b are shared libraries. All modules compile fine except Module4b where I get the following error (with Visual C++, not with Linux/GCC) :
Project5_Module4a.lib(Project5_Module4a.dll) : error LNK2005: "public: virtual __cdecl Project5::Module1::ILocatable<class std::array<double,3> >::~ILocatable<class std::array<double,3> >(void)" (??1?$ILocatable@V?$array@N$02@std@@@Module1@Project5@@UEAA@XZ) déjà défini(e) dans Project5_Module3.lib(LocatableEntity.obj)
Please not that in Debug mode, there are more duplicate symbols (one for each method of ILocatable)
How can I cope with this ? When Module3 is linked dynamically the problem disappears, but I really would like to keep the static libraries. I also tried to instanciate the template with std::array<double,3> in Module3 but :
- This didn't solve my problem
- Most of the users of my project shall use other instanciations, such as Eigen::Vector3d or osg::Vec3d or whatever.
Many thanks for any help !!!
The full project is available here : https://ufile.io/1tkrt6d6 (needs CMake). Here are some parts of code :