关于pthread的问题
#include <iostream>
#include <pthread.h>
using namespace std;
void* task1(void *x)
{
std::cout << "Thread A complete" << std::endl;
return NULL;
}
void* task2(void *x)
{
std::cout << "Thread B complete" << std::endl;
return NULL;
}
int main()
{
pthread_t ThreadA, ThreadB;
pthread_create(&ThreadA, NULL, task1, NULL);
pthread_create(&ThreadB, NULL, task2, NULL);
pthread_join(ThreadA, NULL);
pthread_join(ThreadB, NULL);
return 0;
}
dll 已经copy到 system32, obj,h 也拷贝到正确地方,这么编译链接时候有如下信息:
1>------ 已启动生成: 项目: thread, 配置: Debug Win32 ------
1>正在编译...
1>pThread1.cpp
1>正在编译资源清单...
1>正在链接...
1>pThread1.obj : error LNK2019: 无法解析的外部符号 __imp__pthread_join,该符号在函数 _main 中被引用
1>pThread1.obj : error LNK2019: 无法解析的外部符号 __imp__pthread_create,该符号在函数 _main 中被引用
1>E:\jetvista\thread\Debug\thread.exe : fatal error LNK1120: 2 个无法解析的外部命令
1>生成日志保存在“file://e:\jetvista\thread\thread\Debug\BuildLog.htm”
1>thread - 3 个错误,0 个警告
========== 生成: 0 已成功, 1 已失败, 0 最新, 0 已跳过 ==========