Some days ago I compiled Boost ver. 1.53.0 for VS2012. It works fine, compiles fine. Now I want to use Boost with Qt Creator. In the .pro file I've included
INCLUDEPATH += C:\boost\boost_1_53_0\ -lboost_filesystem
LIBS += C:/boost/boost_1_53_0/stage/lib/
Run Code Online (Sandbox Code Playgroud)
But when I compile I get 2 errors:
:-1: error: cannot find C:/boost/boost_1_53_0/stage/lib/: Permission denied
collect2.exe:-1: error: error: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)
What should I do? I've googled but seems I'm the first with this error.
我需要解析一个看起来像这样的json响应并获取id值,即blabla2:
{
"kind": "blabla",
"id": "blabla2",
"longUrl": "blabla3"
}
Run Code Online (Sandbox Code Playgroud)
我怎么做?我试图使用Qjson,但是当我尝试使用它时.dll,我得到了一个错误:
缺少xlocale.h.

还有其他选择吗?谢谢.
我需要C++(STL)中的hash_map类.主要操作是将对放入集合中,然后检查它是否存在.
我无法找到一个示例代码来确定我是否正确声明了.
#include <iostream>
#include <hash_map>
using namespace std;
using namespace __gnu_cxx;
typedef pair<int,string> pis;
struct eqpis {
bool operator()(pis p1,pis p2) const {
if(p1==p2) return true;
return false;
}
};
int main() {
hash_map<pis,int,hash<pis>,eqpis> map;
}
Run Code Online (Sandbox Code Playgroud)
这个编译.但是如果我添加这行:map [pis(10,"hello")] = 10; 然后它会产生很多错误:
/usr/include/c++/4.4/backward/hashtable.h:在成员函数'size_t __gnu_cxx :: hashtable :: _ M_bkt_num_key(const _Key&,size_t)const [with _Val = std :: pair,std :: allocator >>, int>,_ Key = std :: pair,std :: allocator >>,_ HashFcn = __gnu_cxx :: hash,std :: allocator >>>,_ ExtractKey = std :: …
阅读一些主题我发现了这段代码,我想知道它是如何工作的,因为它是真的:
5
2
Run Code Online (Sandbox Code Playgroud)
代码:
static int a = 7;
int test()
{
return a--;
}
int main()
{
for(test();test();test())
{
cout << test() << "\n";
}
return 0;
}
Run Code Online (Sandbox Code Playgroud) 所以假设我有一个向量,它包含4个elemens [string elements].我需要首先遍历向量,然后遍历每个元素,循环遍历字符数组[元音]并计算该单词包含的元音数量.
for(int i = 0; i < b.size(); i++)
{
for(int j = 0; j < b[i].size(); j++)
{
for(int v = 0 ; v < sizeof( vowels ) / sizeof( vowels[0] ); v++)
if(//blabla)
}
}
Run Code Online (Sandbox Code Playgroud)
所以我的问题是,我怎样才能遍历每个单词,我的意思b[i][j]是正确的方法呢?
如果是的话,这个表格会很好吗?:
if(b[i][j] == vowels[v]) {
//blabla
}
Run Code Online (Sandbox Code Playgroud)
谢谢.
让我们说,一个有8个参与者的课程,我必须以所有可能的方式输出前3个位置.例如:
123 124 125 126 127 128 213等等..
我知道有next_permutation算法,但它返回所有可能的permations与所有数字(从1到8),但我需要前三个地方与所有参与者ex:
1 2 3 4 5 6 7 8
1 2 3 4 5 6 8 7
Run Code Online (Sandbox Code Playgroud) 我有一项任务是将文件保存到计算机.所以这是我的问题,当我写入文件时,它写入十六进制值..我不知道我的代码有什么问题.这里是:
void MainWindow::on_actionSave_triggered()
{
QString filename = QFileDialog::getSaveFileName(
this,
tr("Save Document"),
QDir::currentPath(),
tr("Documents (*.txt)") );
QFile f( filename );
f.open( QIODevice::WriteOnly | QIODevice::Text );
QTextStream out(&f);
out << ui->textEdit->document();
}
Run Code Online (Sandbox Code Playgroud) 我有一个简单的for循环,打印出来[实际上它必须,但它没有]所有数字从1直到'365``(一年).
所以,这是它:
#include <iostream>
using namespace std;
int main()
{
for(int i = 1; i <= 365; i++)
{
cout<<i<<endl;
}
}
Run Code Online (Sandbox Code Playgroud)
所以输出必须是:
1...365
但它就是这样的:
70...365
PS编译和执行时没有任何错误.
我有一个功能,我得到显示分辨率.我提出了一个想法,但结果只是一些正方形.
LPCWSTR GetDispRes(HWND hWnd)
{
HMONITOR monitor = MonitorFromWindow(hWnd, MONITOR_DEFAULTTONEAREST);
MONITORINFO info;
info.cbSize = sizeof(MONITORINFO);
GetMonitorInfo(monitor, &info);
int arr[2];
arr[0] = info.rcMonitor.right - info.rcMonitor.left;
arr[1] = info.rcMonitor.bottom - info.rcMonitor.top;
LPCWSTR a;
std::wstring s = std::to_wstring(arr[0]);
std::wstring d = std::to_wstring(arr[1]);
std::wstring ress = s + d;
a = (LPCWSTR)ress.c_str();
return a;
}
Run Code Online (Sandbox Code Playgroud)
我正在从MessageBox调用此函数
MessageBox(NULL, GetDispRes(hWnd) , TEXT("TEST"), NULL);
Run Code Online (Sandbox Code Playgroud)
这是输出:
http://s7.directupload.net/images/131011/fw9j26c9.png
我的问题是,是什么导致了这个输出?有什么其他方法可以实现这一目标?(将int转换为LPWCSTR)?谢谢.