我的代码在我的mac上完美运行,但不能在linux上编译。我收到编译错误
$schoolyear = $('select#schoolyear');
$schoolterm = $('select#schoolterm')
$tbl = $('#classview');
$schoolyear.change(function () {
getCL();
});
$schoolterm.change(function () {
getCL();
});
function getCL() {
$.getJSON('@Url.Action("getClassList","Enrollment")', { term: $schoolterm.val(), year: $schoolyear.val() }, function (e) {
$tbl.find('tbody').remove();
if (e.length > 0) {
$(e).each(function (index, e) {
$tbl.append('<tr><td>' + e.subj + '</td><td>' + e.days + '</td><td>' + e.cstart + '</td><td>' + e.cend + '</td><td>' + e.professor + '</td><td>' + e.units + '</td><td>' + e.status +
'</td>' + '<td>' + '<form action="/Enrollment/dropClass" method="post">' + '<input type="hidden" name="test" value="'+e.id+'"/>' +
'<a href="#"> Delete </a>' + '</form></td></tr>')
});
}
else {
$tbl.append('<tr><td colspan="8">No match found</td></tr>');
}
//compute t
});
}
有没有人知道这个错误信息意味着什么或为什么我得到它因为我无法弄明白。
/tmp/ccWcFSEW.o: In function `main':
DroneMap.cpp:(.text.startup+0x22d): undefined reference to `pthread_create'
DroneMap.cpp:(.text.startup+0x262): undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
答案 0 :(得分:3)
您需要在编译命令中包含pthread库,我不知道如何在MAC中编译它,但是正确的linux编译命令就是这样。
CXX=g++
CXXFLAGS=-pthread -Wall -O3
all: DroneMap
clean:
rm -rf DroneMap