草庐IT

local-only

全部标签

c++ - 不合格的名称查找 : Why local declaration hides declaration from using directive

考虑这段代码:namespaceA{inti=24;}namespaceB{usingnamespaceA;inti=11;intk=i;//findsB::i,noambiguity}和basic.lookup.unqual.2:§6.4.1Unqualifiednamelookup[basic.lookup.unqual]Thedeclarationsfromthenamespacenominatedbyausing-directivebecomevisibleinanamespaceenclosingtheusing-directive;see[namespace.udir].F

c++ - 从库中的 std::exception 派生:Does a headers-only solution work for catching exceptions?

在我们的跨平台开源库中,我们派生自std::exception以定义可以在库代码和用户代码中捕获的自定义异常。我看到这实际上是一个推荐的过程,但在VisualStudio2015(或者更确切地说,伴随的新MSVC版本?)中,在实现类(warningC4275)中抛出警告-另请参见此处:Howtodllexportaclassderivedfromstd::runtime_error?当然我们可以忽略这个错误,但这对我来说似乎是错误的。与旧的VisualStudio版本相比,出现警告的原因似乎是std::exception曾经在旧的MSVC版本中导出,但同时不再导出。无论哪种情况,我都觉

c++ - 错误 C4703 : potentially uninitialized local pointer variable 'pNamesPtr' used

我正在做一个加密项目,在尝试编译程序时遇到了以下错误。main.cpp(520):errorC4703:potentiallyuninitializedlocalpointervariable'pNamesPtr'used==========Build:0succeeded,1failed,0up-to-date,0skipped==========DLLNAMES[i].UsedAlready=0;}*dwOutSize=(DWORD)pNamesPtr-(DWORD)pBuffer;//*有人可以帮我解决这个错误吗?您是否需要更多代码才能得到好的答案?

c++ - Visual Studio 错误 : LNK1104: cannot open file 'kernel32.lib' - only in WP8 projects/Win32 builds

我最近遇到了这个问题(几天前一切正常):VisualStudio2012开始拒绝构建原生WP8项目。今天,我从模板“WindowsPhoneDirect3D应用程序(仅限native)”创建了新解决方案,以检查WP是否正确支持我新创建的DLL。我尝试编译这个项目,首先没有任何更改或额外的引用-VS生成的纯代码。但是,它因给定错误而失败。我很清楚这是什么意思,可能的原因是什么,但是我不明白,在这种情况下它是从哪里来的。奇怪的事情:这只发生在“Win32”配置中,ARM编译正常:1>------Buildstarted:Project:PhoneDirect3DApp,Configurat

Ubuntu扩容报错:Unable to resize read-only file system /dev/sda3

当我们给Ubuntu新划分了空间,但是去给磁盘划分的时候,会报错:Unable to resize read-only file system /dev[sda3The file system can not be resized while it is mounted read-only.Either unmount the file system or remount it read-write.这是因为磁盘没有挂载起来,因此需要查看该磁盘的挂载路径,首先右键/dev/sda3点击信息,进去后就可以看到挂载的路径,分别是/和/var/snap/firefox/common/host-hun

C++ 局部变量和线程(非 thread_local)

局部数组和线程交互的C++98和C++11内存模型是什么?我不是指的是C++11thread_local关键字,它与全局变量和静态变量有关。相反,我想找出在编译时分配的数组线程的保证行为是什么。我所说的编译时指的是“intarray[100]”,这与使用new[]关键字进行分配不同。我不是指静态变量。例如,假设我有以下结构/类:structxyz{intarray[100];};和以下函数:voidfn(intx){xyzdog;for(inti=0;i从多个线程调用fn()安全吗?看起来C++的内存模型是:所有局部非静态变量和数组都分配在栈上,每个线程都有自己的栈。这是真的吗(即,这

c++ - 解决 "only static const integral data members can be initialized within a class"编译错误

以下创建全局对象会导致编译错误。#include"stdafx.h"#includeusingnamespaceSystem;usingnamespacestd;#pragmahdrstopclassTester;voidinput();classTester{staticintnumber=5;public:Tester(){};~Tester(){};voidsetNumber(intnewNumber){number=newNumber;}intgetNumber(){returnnumber;}}TestertesterObject;voidmain(void){cout>ne

c++ - 为什么 std::locale loc ("en_US") 抛出异常?

我试图用美国或英国语言环境字符串实例化一个std::locale对象。std::localeloc("en_US")和std::localeloc("en_GB")都抛出一个错误的语言环境名称运行时异常.使用""或"C"创建语言环境效果很好;但是,我在设置单个国家/地区时遇到问题。我想这样做的原因是出于单元测试的目的,以确保一组字符串排序方法能够正常工作。我还应该指出,我正在使用VisualStudio2008在Windows中编写代码,如果可能的话,我希望让我的代码跨平台。 最佳答案 std::locale支持的字符串是特定于实现

c++ - QSocketNotifier : Can only be used with threads started with QThread error

我正在尝试使用QLocalServer作为ipc解决方案。qt的版本是4.6这是我的main.cpp:intmain(intargc,constchar*argv[]){QServertest();while(true){}}这是我的QServer类:classQServer:publicQObject{Q_OBJECTpublic:QServer();virtual~QServer();private:QLocalServer*m_server;QLocalSocket*m_connection;privateslots:voidsocket_new_connection();};Q

Kettle Local引擎使用记录(一)(基于Kettle web版数据集成开源工具data-integration源码)

KettleWeb📚第一章前言📚第二章demo源码📗pom.xml引入Kettle引擎核心文件📗java源码📕controller📕service📕其它📕mavensettings.xml📗测试📕测试文件📕测试结果⁉️问题记录❓问题一:jar包冲突-`Anattemptwasmadetocallthemethodjavax.servlet.ServletContext.setInitParameter(Ljava/lang/String;Ljava/lang/String;)Zbutitdoesnotexist.Itsclass,javax.servlet.ServletContext,isa