我gmp-6.0.0a.tar.xz在usr/local目录中下载了文件并解压缩(tar).随着人们说,我输入./configure,make,make check和sudo make install在gmp-6.0.0目录中.安装似乎很好.但是,当我试图像这样测试
#include <stdio.h>
#include <gmp.h>
#include <gmpxx.h>
int main(int argc, const char * argv[])
{
// insert code here...
printf("Hello, World!\n");
return 0;
}
Run Code Online (Sandbox Code Playgroud)
它有错误,gmp.h找不到文件.我添加-lgmp到Other Linker Flags但不起作用.
我不知道如何处理这类问题.有人可以帮忙吗?
谢谢Dietrich Epp.现在我没有找到gmp.h文件的错误,但是我找不到gmpxx.h文件.我不知道为什么..
有什么建议吗?
我想做的是从每个线程返回一个值。但是,它具有此异常消息。
libc++abi.dylib: terminating with uncaught exception of type std::__1::future_error: Operation not permitted on an object without an associated state.
Run Code Online (Sandbox Code Playgroud)
代码看起来像这样。
vector<thread> t;
promise<class_name> promises;
vector<future<class_name>> futures;
for(int i = 0; i < NumberOfThreads; i++)
{
futures.push_back(promises.get_future());
t.push_back(thread(MyFunction ,i , pointList, std::move(promises)));
}
Run Code Online (Sandbox Code Playgroud)
MyFunction看起来像这样。
void MyFunction(int index, const vector<Point>& pointList, promise<class_name>&& p)
{
....
p.set_value(classObj);
}
Run Code Online (Sandbox Code Playgroud)
如果使用线程,则可以正常工作而不会出现异常消息。
有解决这个问题的主意吗?
fun a(list) =
let
val num = length(hd(list))
fun inner(list) =
if num = length(hd(list)) then
if tl(list) = nil then true
else inner(tl(list))
else false
in
if length(hd(list))-1 = length(tl(list)) then inner(tl(list))
else false
end;
Run Code Online (Sandbox Code Playgroud)
这是 ml 代码,我收到了此警告和类型。
stdIn:6.16 Warning: calling polyEqual
val a = fn : ''a list list -> bool
Run Code Online (Sandbox Code Playgroud)
我不明白警告。它出现的原因和类型。''a为什么它有两个'?''?'a list list 和''a list list 有什么区别?