草庐IT

not_analyzed

全部标签

c++ - 带有 boost 的 CMake(在 Windows 上):Could not find libraries?

我正在尝试使用CMake构建我的项目。我也在使用boost。我的CMakeLists.txt文件中的查找包语句是:find_package(Boost1.42所需组件python系统文件系统序列化线程程序选项正则表达式test_exec_monitor)构建失败,我收到的错误消息是:找不到以下Boost库:boost_systemboost_filesystemboost_serializationboost_threadboost_program_options当我检查我的lib目录时,我发现这些库的名称是:libboost-vc100-mt.lib而不是boost_事实上,当我根据

c++ - 谷歌模拟 : why NiceMock does not ignore unexpected calls?

我正在使用GoogleMock1.7.0和GoogleTest1.7.0。问题是当我使用NiceMock时,由于意外的模拟函数调用(根据GoogleMock文档,NiceMock应该忽略它)导致测试失败。代码如下所示://GoogleMocktest#include#includeusing::testing::Return;using::testing::_;classTestMock{public:TestMock(){ON_CALL(*this,command(_)).WillByDefault(Return("-ERRNotUnderstood\r\n"));ON_CALL(*

c++ - Xcode C++ : Build in Debug but not Release

我正在使用Xcode6、c++进行编码。我可以在调试中构建和运行我的程序,但我无法以某种方式在Release模式下编译。我看到的错误是:AppleLLVM6.0错误无法读取配置文件:没有这样的文件或目录我真的不知道这是什么意思...(在将main.cpp文件缩减为通常的“HelloWorld”程序后我仍然明白这一点)我已经按照建议尝试了XcodebuildsonDebugbutnotonRelease清理我的项目,关闭它,关闭Xcode重新启动并重建,甚至删除派生数据,但我仍然遇到同样的问题。有人知道如何解决这个问题吗?非常感谢T 最佳答案

c++ - "QIODevice::write: device not open"文件打开时

当我编译我的程序时,我收到错误消息“QIODevice::write:devicenotopen”这个程序在我的旧电脑上运行但由于某种原因它在我的新电脑上不运行。非常感谢任何有关如何修复此错误的见解,谢谢。file.open(QIODevice::Append);file2.open(QIODevice::Append);QTextStreamstream(&file);//streamofinformationQTextStreamstream2(&file2);//writetofile//codecontinuedhere,deletedtoposthere...stream

java - 性能优化 : C++ vs Java not performing as expected

我编写了两个程序来实现一个简单的矩阵乘法算法,一个用C++编写,一个用Java编写。与我的预期相反,Java程序的运行速度比C++程序快大约2.5倍。我是C++的新手,希望就我可以在C++程序中进行哪些更改以使其运行更快提出建议。我的程序从这篇博文中借用了代码和数据http://martin-thoma.com/matrix-multiplication-python-java-cpp.以下是我正在使用的当前编译标志:g++-O3main.ccjavacMain.java以下是当前的编译器/运行时版本:$g++--versiong++.exe(GCC)4.8.1Copyright(C)

c++ - "gets() was not declared in this scope"错误

这个问题在这里已经有了答案:whyg++shows"gets()"notdeclared,evenafterincluding(3个答案)关闭2年前。使用以下代码,我得到“gets()未在此范围内声明”错误:#include#includeusingnamespacestd;intmain(){//stringstr[]={"Iamaboy"};stringstr[20];`gets(str);cout

c++ - CA2W 给了我一个 "' AtlThrowLastWin3 2': identifier not found"错误

当我遵循MSDNdocument时,我遇到了一个奇怪的编译错误在VisualStudio2005中使用CA2W将big5字符串转换为unicode字符串。这是我写的代码:#include#include#includeusingnamespacestd;int_tmain(intargc,_TCHAR*argv[]){stringchineseInBig5="\xA4\xA4\xA4\xE5";ATL::CA2W(chineseInBig5.c_str());return0;}编译错误:errorC3861:'AtlThrowLastWin32':identifiernotfound我

c++ - "thread-local storage not supported for this target",适合#ifdef?

由于每个编译器都有自己的线程本地存储版本,我最终为它创建了一个宏。现在唯一的问题是GCC(关闭了pthreads),这给了我:“此目标不支持线程本地存储”很公平,因为在这种情况下pthreads实际上是关闭的。问题是,是否有一种通用的方法可以使用一些宏来检测这一点,例如#ifdef__GCC_XXX_NO_THREADS_XXX?编辑:请参阅下面接受的答案。另外,这是我的懒惰解决方案:$touchtest.c$gcc-E-dMtest.c>out.1$gcc-pthread-E-dMtest.c>out.2$diffout.*28a29>#define_REENTRANT1这是在Mac

c++ - #include <string> 在 header 中定义了一些结构。错误 : string does not define a type

#ifndefSTRCUTS_H#defineSTRCUTS_H#includestructmenuEntry{stringitemID;//'string'doesnotnameatypestringitemName;//'string'doesnotnameatype};#endif当我将#include放在header保护上方时,我得到了同样的错误。想一想,我以前在将结构定义放在标题中时遇到过奇怪的麻烦。一定是我没有得到的东西。 最佳答案 您需要将string更改为std::string,即#ifndefSTRCUTS_H#d

c++ - 迭代器声明 : "does not contain a type"

我很难理解为什么会收到此错误。我指的是Josuttis的STL书和其他资源,看来我在下面声明我的迭代器的方式应该有效:#ifndefLRU_H#defineLRU_H#include#includeclassLRU{public:LRU();//defaultconstructorLRU(int);//constructorwithargument~LRU();//destructor//Methods//voidenqueue(int);//adddatumtothequeuevoiddequeue();//removedatumfromthequeuevoidreplace();/