草庐IT

Wsubobject-linkage

全部标签

c++ - 开发-C++/TDM-GCC : Linkage Problems with Boost Libaries Downloaded from boost. 组织

我正在尝试在Dev-C++(tdm-gcc4.7.1)中使用regex。我已经从boost.org下载了Boost库并解压到C:\ProgramFiles(x86)\Dev-Cpp\boost并在Dev-C++中添加C:\ProgramFiles(x86)\Dev-Cpp\boost\libs去图书馆。包含路径(C/C++):C:\ProgramFiles(x86)\Dev-Cpp\boostmain.cpp:#includeusingnamespaceboost;intmain(){strings("sometxtPING:665454some_text");smatchmt;reg

c++ - "internal linkage"是什么意思?

在标准中它说:Whenanamehasinternallinkage,theentityitdenotescanbereferredtobynamesfromotherscopesinthesametranslationunit.和:Anamehavingnamespacescope(3.3.6)hasinternallinkageifitisthenameof—avariable,functionorfunctiontemplatethatisexplicitlydeclaredstatic;因此请考虑以下代码:#includenamespaceA{/*awithinternalli

c++ - 为什么不允许使用 "second C linkage of overloaded function"?

我将我的C++dll转换为Cdll:#ifdef__cplusplusextern"C"{#endifMY_EXPORTintmy_func();MY_EXPORTvoidmy_func(intn);#ifdef__cplusplus}#endif没有externC声明一切正常。有了这个声明,我得到了errorC2733:secondClinkageofoverloadedfunction'my_func'notallowed为什么不允许从C风格的dll导出重载函数? 最佳答案 C不允许重载函数。那就是C不支持重载。这是C++的一个

c++ - 错误 C2375 : redefinition; different linkage

api中错误的地方:#defineDLLEXPORTextern"C"__declspec(dllexport)DLLEXPORTintCAnyseeUSBTVControllerDlg::InitCaptureDevice(){在我的.h库类和函数定义中:classCAnyseeUSBTVControllerDlg:publicCDialog{//Constructionpublic:intInitCaptureDevice(void);知道如何解决吗?"Error1errorC2375:'CAnyseeUSBTVControllerDlg::InitCaptureDevice':r

c++ - 如何修复 -Wsubobject-linkage 警告?

我在clang和VC++中收到编译良好且无警告的代码的gcc警告,因此我假设它是特定于gcc的。这是代码:namespacemyns{usingTokenList=std::vector;usingRuleList=std::vector;usingRulePathPair=std::pair;usingCandidatesCollection=struct{std::maptokens;std::setrules;};classA{private:CandidatesCollection_candidates;};}//namespacemyns警告是:warning:'myns::

linux - 模块编译 : asm/linkage. h 文件未找到

我正在尝试编译“helloworld”内核模块的示例,在ubuntu11.04、内核3.2.6、gcc4.5.2和fedora16、内核3.2.7、gcc4.6.7上发现问题。代码:#include#includeMODULE_LICENSE("GPL");staticint__inithello_init(void){printk("Hellomoduleinit\n");return0;}staticvoid__exithello_exit(void){printk("Hellomoduleexit\n");}module_init(hello_init);module_exit(

linux - 模块编译 : asm/linkage. h 文件未找到

我正在尝试编译“helloworld”内核模块的示例,在ubuntu11.04、内核3.2.6、gcc4.5.2和fedora16、内核3.2.7、gcc4.6.7上发现问题。代码:#include#includeMODULE_LICENSE("GPL");staticint__inithello_init(void){printk("Hellomoduleinit\n");return0;}staticvoid__exithello_exit(void){printk("Hellomoduleexit\n");}module_init(hello_init);module_exit(

C++ 警告 : anonymous type with no linkage used to declare variable

编译(gcc4.6.3,ubuntu)示例时看到此警告消息:struct{}a;intmain(){}warning:anonymoustypewithnolinkageusedtodeclarevariable‘a’withlinkage[enabledbydefault].GCC没有给出这个警告。只有G++可以。添加static清除警告:staticstruct{}a;我不明白它是什么意思,特别是为什么type与linkage相关。我认为链接取决于变量的声明位置和方式,而不取决于变量本身的类型。 最佳答案 这意味着变量a具有链接

C++ 警告 : anonymous type with no linkage used to declare variable

编译(gcc4.6.3,ubuntu)示例时看到此警告消息:struct{}a;intmain(){}warning:anonymoustypewithnolinkageusedtodeclarevariable‘a’withlinkage[enabledbydefault].GCC没有给出这个警告。只有G++可以。添加static清除警告:staticstruct{}a;我不明白它是什么意思,特别是为什么type与linkage相关。我认为链接取决于变量的声明位置和方式,而不取决于变量本身的类型。 最佳答案 这意味着变量a具有链接

c++ - 如何定义C结构: c-linkage and udt

我用C-ABI接口(interface)用X语言编写了dll。我想在我的C++程序中使用这个C-ABI。我在main.cpp中这样写:extern"C"{structFoo{constchar*constdata;unsignedlen;};structFoof(void);}intmain(){}并得到编译器的警告(visualc++/15.7.5/windows7/32bit):(7):warningC4190:'f'hasC-linkagespecified,butreturnsUDT'Foo'whichisincompatiblewithC(7):note:seedeclara
12