小编jus*_*tin的帖子

Pthreads C++编译错误

我收到错误"对'pthread_attr_init'的未定义引用",即使它应该在pthread.h中.这是在应该为Pthreads设置的UNIX环境中.是一个空洞*是指向当前矩阵的好方法吗?这是我的代码,任何想法?

#include <cstdlib>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <time.h>
#include <limits.h>
#include <pthread.h>
#include <semaphore.h>

#define MAX_MATRIX_SIZE     256
#define MAX_THREADS         64

using namespace std;

void *StripProcessor(void *);
void Barrier();
void InitMatrix(int rows, int cols);

int main(int argc, char *argv[])
{
    /* Get command line params */
    if (argc != 3) {
        cout << "Error: need 2 command line params." << endl;
        getchar();
        return 1;
    }
    int numThreads = atoi(argv[1]);
    double epsilon = atof(argv[2]);


    /* Locals hang …
Run Code Online (Sandbox Code Playgroud)

c++ pthreads

3
推荐指数
1
解决办法
3193
查看次数

标签 统计

c++ ×1

pthreads ×1