草庐IT

qmake-variable-reference

全部标签

c++ - qmake 生成的 Makefile 中缺少 QtWebKit 依赖项

我刚开始使用Qt(C++),所以我遵循了一个我在网上找到的“hello,world”示例。我在目录hello中创建了程序hello.cpp:#includeintmain(intargc,char*argv[]){QApplicationapp(argc,argv);QLabellabel("Hello,world!");label.show();returnapp.exec();}我跑了:qmake-projectqmakehello.promake一切都正确编译,我能够运行./hello。然后,作为一个有冒险精神的人,我尝试修改文件:#include#includeintmain(

c++ - 链接错误 : undefined reference to EVP_CIPHER_CTX_ and EVP_CIPHER_CTX_init

我在我的代码中使用了crypto++。我不想使用它的依赖项,所以我尝试在我的文件夹中导入crypto++文件并将它们包含在我的.cpp文件中我有以下错误:TEST.cpp:(.text+0x89a0):undefinedreferenceto`EVP_CIPHER_CTX_init'TEST.cpp:(.text+0x8cb0):undefinedreferenceto`EVP_aes_128_cbc'TEST.cpp:(.text+0x8cdd):undefinedreferenceto`EVP_CipherInit_ex'TEST.cpp:(.text+0x8d49):undefi

c++ - 内联函数中的 undefined reference ,用一元 + 解决

我在启用c++11时遇到一个奇怪的gcc4.7问题:当我想编译这个时:constexprunsignedintgetDim(constinte){return(e==1)?A::Set::Dimension:((e==2)?B::Set::Dimension:((e==3)?C::Set::Dimension:(+D::Set::Dimension)));}其中对于每个结构A,B,C,D定义了Set的typedef,其中相关的Set有一个intDimension,例如structSetOne{staticconstintDimension=1;}structA{typedefSetOn

c++ - GLEW 和 glfw 编译错误 : undefined reference to symbol 'XConvertSelection'

我正在尝试编译这段代码:#include#include#include#includeGLFWwindow*window;#includeusingnamespaceglm;intmain(void){//InitialiseGLFWif(!glfwInit()){fprintf(stderr,"FailedtoinitializeGLFW\n");return-1;}glfwWindowHint(GLFW_SAMPLES,4);glfwWindowHint(GLFW_RESIZABLE,GL_FALSE);glfwWindowHint(GLFW_CONTEXT_VERSION_MA

c++ - 转到特定页面后,如何将SwipeView的currentIndex设置为TabBar的currentIndex "by reference"?

我开始使用QtQuickControls2.0。我有使用C++的经验和少量的Qt经验,但我以前没有使用过QML。我有一个TabBar和一个SwipeView相互链接。我的意思是,当您在TabBar上选择一个页面时,SwipeView会转到该页面。当您从SwipeView滑动到一个页面时,TabBar会自行更新以反射(reflect)这一点。作为学习练习,我决定创建一个将用户转到第二页的按钮。问题是我似乎无法找到一种方法来做到这一点而不会弄乱TabBar和SwipeView之间的链接。下面的代码是我想出的最好的。它正确转到第二页,当我使用TabBar更改当前页面时,SwipeView仍会

c++ - std::reference_wrapper *this 周围

我有一个场景,我需要转换一个可以被*this链接的函数返回std::optional>而不是T&(原因超出了这个问题的范围)。我使用std::reference_wrapper的原因是因为std::optional不能引用,至少在C++11中不能。但是,这不起作用,因为我似乎遇到了终身问题。这是一个最小的例子:#include#includestructtest{std::reference_wrapperfoo(){val=42;return*this;}test&foo2(){val=50;return*this;}intval;};voidbar(testt){std::cout

c++ - 构造函数设置的 "const variables"用于表示 C++ 数组的边界?

下面的代码可以编译并且运行良好:classTest{private:constunsignedMAX;public:Test(constunsignedintn):MAX(n){}voidfoo(){intarray[MAX];...}};但是真的可以吗?我的意思是:Testa(3);Testb(8);array实际上分别有3个和8个单元格吗?如果是这样,是不是因为array是一个自动var并使用适当的维度进行实例化?谢谢 最佳答案 你写的在c99有效但不有效c++.我当然是在谈论您对VLA的使用的,而不是完整的片段。当使用g++-

c++ - condition_variable 的常见用例场景

条件变量可用于向其他线程发出信号,表明发生了某些事情:mutexm;condition_variablecv;threadt1([&cv]{//processing...cv.notify_one();});...unique_locklck(m);cv.wait(lck);但是正如您所看到的,在我们等待通知之前,有一个机会窗口,线程处理完成并且通知正在通过,所以我们将永远等待。在这种情况下,常见的解决方案是使用标志:mutexm;condition_variablecv;booldone=false;threadt1([&cv,&done]{//processing...done=t

c++ - "crosses initialization of variable"仅当初始化结合声明时

我读过thisquestion关于“跳转到案例标签”错误,但我还有一些疑问。我在Ubuntu12.04上使用g++4.7。这段代码报错:intmain(){intfoo=1;switch(foo){case1:inti=0;i++;break;case2:i++;break;}}错误是jump-to-case-label.cpp:Infunction‘intmain()’:jump-to-case-label.cpp:8:8:error:jumptocaselabel[-fpermissive]jump-to-case-label.cpp:5:9:error:crossesinitia

c++ - Google 使用 SetUpTestCase 静态变量测试 undefined reference

我正在编写一个测试用例,它将有一个SetUpTestCase()方法,尽管我收到undefinedreference链接器错误,但该方法将分配一个共享资源。classParsingEventsTest:public::testing::Test{protected:staticxmleventXml;staticvoidSetUpTestCase(){ManagedObjectManagerSingleton::GET_SINGLETON().initializeTestEnvironment(PATH_TO_FILE);eventXml=*ManagerSingleton::GET_