草庐IT

undefined-index

全部标签

c++ - 对静态常量整数类型的 undefined reference

我对静态整数常量有一个奇怪的行为:#include#includeclassTest{public:staticconstuint32_tMagic=0x1123;};classDataStream{public:templateDataStream&operator我知道这些常量应该在.cpp类之外定义为constuint32_tTest::Magic;但奇怪的是,上面的代码在s行下工作正常并且仅在Magic时产生错误与模板一起使用operator直接。更多错误undefinedreferenceto'Test::Magic'与GCC一起出现,但不是MSVC.问题是为什么我要定义Te

c++ - Xcode C++ vector : Implicit instantiation of undefined template

我在不同的IDE上运行这段代码,它成功了。出于某种原因,我在Xcode上收到上述错误消息。我假设我缺少某种标题,但我不确定是哪一个。#include#include#include#includeintmain(){vectorlistRestaurants;//error:Implicitinstantiationofundefinedtemplatereturn0;} 最佳答案 Xcode10.2.1向我展示了错误Implicitinstantiationofundefinedtemplate'std::__1::vector,

c++ - Boost Multi-Index 自定义复合键比较器

我正在寻找为带有复合键的boostordered_non_unique索引编写自定义比较器。我不确定该怎么做。Boost有一个composite_key_comparer,但这对我不起作用,因为键成员的比较器之一取决于前一个成员。这是一个简化的示例,但我希望当second_为“A”时,索引按third_降序排序,首先为third_保留0值,然后在所有其他情况下使用std::less。希望这是有道理的。我想打印下面的代码:3,BLAH,A,05,BLAH,A,112,BLAH,A,104,BLAH,A,91,BLAH,A,8代码将代替这里有什么???。感谢您的帮助。#include#in

c++ - 将 boost 与 MinGW 一起使用时对 WinMain@16 的 undefined reference

我在Windows7下使用Eclipse使用C++进行编程。我的makefile如下:build:g++-shared-o"lib\libCacheOpt.a""src\*.cpp"-enable-auto-import-I"${CWD}\include"-I"${BOOST}"-L"${BOOST}\lib"-lboost_program_options-lboost_unit_test_frameworkexec:buildg++"src\main.cpp"-enable-auto-import-I"${CWD}\include"-L"${CWD}\lib"-I"${BOOST}"

c++ - MinGW 上支持 OpenMP 的 Qt 插件 : Undefined reference?

我正在开发一个使用OpenMP的“Qt插件”(可以使用CMake参数启用/禁用OpenMP支持)。我使用MinGW和CMake作为开发环境。这就是我在代码中启用/禁用OpenMP的方式:#ifdefOPENMP_ENABLE#pragmaompparallelfor#endiffor(inti=0;igetZSize();i++){.我在CMake文件中启用了OpenMP,如下所示:OPTION(OPENMP_SUPPORT"BuildwithOpenMPparallaizationenabled")IF(OPENMP_SUPPORT)FIND_PACKAGE(OpenMP)SET(C

c++ - 如何解决 : undefined reference to `non-virtual thunk to ...`

我正在尝试弄清楚如何进一步解决此问题。我还想知道如何安装更新版本的ld(如果有意义的话)。所有涉及的包管理器都告诉我,我是最新的。代码在ubuntu12.04和12.10上使用g++(4.7.2)编译、链接和运行,但在FC17上编译失败并出现此错误。ArchiveServiceLib/debug-posix/libArchiveLib.a(NamedIflTiffCache.o):(.rodata._ZTV26UnlockingGenericFileHandle[_ZTV26UnlockingGenericFileHandle]+0x58):undefinedreferenceto`I

c++ - 编译多个文件时出现奇怪的 undefined reference 错误

这个问题在这里已经有了答案:Whycantemplatesonlybeimplementedintheheaderfile?(17个答案)关闭9年前。我正在尝试编写一个玩具程序来练习C++,但我遇到了一个我无法解决的奇怪的undefinedreference错误。我的代码由3个文件组成:ex13_6.h:#includenamespaceex13_6{templateclassCmp{public:staticinteq(Ta,Tb){returna==b;}staticintlt(Ta,Tb){returna>voidbubble_sort(std::vector&v);}ex13_

c++ - 关于 C++ Boost 图创建和 vertex_index 属性。

我是boost菜鸟。我想知道为什么以下代码编译失败。我正在创建一组顶点,并尝试分配我自己的顶点索引和顶点名称。(我正在关注此页面:http://fireflyblue.blogspot.com/2008/01/boost-graph-library.html。)我知道Boost中的vertS顶点列表不需要显式创建顶点ID,而且我还在Stackoverflow(howprovideavertex_indexpropertyformygraph)中看到了这个非常相关的问题讨论如何使用associative_property_map分配顶点索引。以下虽然-获取vertex_index映射,并

c++ - SFML 2.1 架构 x86_64 错误的 undefined symbol

我最近安装了SFML2.1并尝试从终端编译和运行,而不是Xcode,他们网站上的示例程序http://www.sfml-dev.org/tutorials/2.0/start-linux.php.PathtowhereIinstalledSFML:/Users/.../Desktop/C++_Code/SMFL/SFML-2.1-osx-gcc-universal但是,我不断收到以下错误:Undefinedsymbolsforarchitecturex86_64:"sf::String::String(charconst*,std::__1::localeconst&)",refere

c++ - Lua 5.3 undefined reference

我正在尝试学习如何将lua嵌入到C程序中,但我不擅长阅读技术文档,而且我还没有找到任何当前教程。这是我的程序:#include#include#include#includevoidreport_errors(lua_State*,int);intmain(intargc,char**argv){for(intn=1;n编译器给出了luaL_newstate、luaL_openlibs、luaL_loadfilex、lua_pcallk和lua_close的undefinedreference错误。我在一台Windows计算机上使用Code::Blocks,我已将luainclude目