我在Ubuntu Trusty上,我正在使用此命令构建以下代码.我是clang的新手,我可以使用帮助来调试这些错误.这些C绑定的cpp和hpp文件来自编译.我将这些文件中的标题复制到我在此处列出的文件w.cpp中
clang -std=c++11 w.cpp -o w `pkg-config --cflags --libs opencv`
Run Code Online (Sandbox Code Playgroud)
以下是错误:
/usr/bin/ld: /tmp/w-2a90f4.o: undefined reference to
symbol '_ZNSt8ios_base4InitD1Ev@@GLIBCXX_3.4'
//usr/lib/x86_64-linux-gnu/libstdc++.so.6: error adding
symbols: DSO missing from command line
clang: error: linker command failed with exit code 1
(use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)
这是w.cpp的内容.我正在尝试使用clang对代码进行基准测试.
#include <opencv2/c/mat.hpp>
#include <opencv2/c/opencv_generated.hpp>
using namespace cv;
using namespace std;
using namespace flann;
using namespace cvflann;
void cv_delete(char* self) {
delete self;
}
Mat* cv_create_Mat() {
return new Mat();
}
BFMatcher* cv_create_BFMatcher(int normType, bool crossCheck) {
return …Run Code Online (Sandbox Code Playgroud) 我刚开始写这个函数,我想知道是否有办法,如果只输入&key参数,可以忽略&可选列表.
(defun test (&optional arg (i 0) &key (size s))
...)
Run Code Online (Sandbox Code Playgroud)
我希望能够跑
(test arg)
Run Code Online (Sandbox Code Playgroud)
要么
(test arg i)
Run Code Online (Sandbox Code Playgroud)
但是也
(test :size)
Run Code Online (Sandbox Code Playgroud)
现在这是一个更好的模拟,但我不知道放在哪里:大小在params列表中
(defun test (&optional arg (i 0))
(cond ((eq arg nil) (return-from test (test-1)))
((listp arg)
(return-from test (test-2 arg)))
((pointerp arg) (mem-aref (test-3 arg) :int i))
(:size (size-test arg))
(t nil)))
so i can run (test) and get:
<output of (test-1)>
I can run (test '(1 2 3)) and get:
<output of (test-2 arg)>
I can run (test …Run Code Online (Sandbox Code Playgroud)