我已经从网站上的 zip 文件中提取了源代码并将它们放在 Code::Blocks 的“包含”文件夹中,但即便如此它也无法编译提供的“hello.cpp”示例。
(以供参考:)
#include <iostream>
#include <tinythread.h>
using namespace std;
using namespace tthread;
// This is the child thread function
void HelloThread(void * aArg)
{
cout << "Hello world!" << endl;
}
// This is the main program (i.e. the main thread)
int main()
{
// Start the child thread
thread t(HelloThread, 0);
// Wait for the thread to finish
t.join();
}
这些是以下错误:
|41|undefined reference to `tthread::thread::thread(void (*)(void*), void*)'|
|44|undefined reference to `tthread::thread::join()'|
|44|undefined reference to `tthread::thread::~thread()'|
|44|undefined reference to `tthread::thread::~thread()'|
wxDev-C++ 也会发生同样的事情。我错过了什么吗?像,我需要建立图书馆或任何东西吗?如果是这样,怎么做?