小编was*_*123的帖子

为什么我的简单编译会失败?

所以我只是从自制软件安装gcc,我有一个简单的代码:

#include <cmath>
#include <iostream>
#include <stdio.h>

int main()
{
    const int size = 256;
    double sinTable[size];

#pragma omp parallel for
    for(int n=0; n<size; ++n)
        sinTable[n] = std::sin(2 * M_PI * n / size);

#pragma omp parallel for
    for(int n=0; n<10; ++n)
    {
        printf(" %d", n);
    }
    printf(".\n");

    // the table is now initialized
}
Run Code Online (Sandbox Code Playgroud)

但是,当我编译时,我失败了:

    dhcp-18-189-47-44:openmp_code myname$ gcc-4.8 tmp2.cpp 
Undefined symbols for architecture x86_64:
  "std::ios_base::Init::Init()", referenced from:
      __static_initialization_and_destruction_0(int, int) in ccFbBrPl.o
  "std::ios_base::Init::~Init()", referenced from:
      __static_initialization_and_destruction_0(int, int) in ccFbBrPl.o
ld: …
Run Code Online (Sandbox Code Playgroud)

c++ openmp

-2
推荐指数
1
解决办法
83
查看次数

标签 统计

c++ ×1

openmp ×1