GSL的“未定义符号”

时间:2017-04-13 12:47:18

标签: c++ g++ visual-studio-code gsl

我正在学习C ++和GSL(GNU科学图书馆)。我尝试使用vscode构建一个简单的程序,但是我收到了这个错误。

Undefined symbols for architecture x86_64:
  "_gsl_rng_types_setup", referenced from:
    _main in Playground-0f069f.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我的代码就是这个

#include <gsl/gsl_rng.h>
#include <iostream>
#include <stdio.h>
#include <stddef.h>
#include <gsl/gsl_sort_double.h>
#include <gsl/gsl_matrix.h>

int main(){
    const gsl_rng_type **t, **t0;
    t0 = gsl_rng_types_setup (); 
    for (t = t0; *t != 0; t++) {
        std::cout<<(*t)->name; 
    }
}

task.json

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "0.1.0",
    "command": "g++",
    "isShellCommand": true,
    "args": ["-o", "Playground", "Playground.cpp"],
    "showOutput": "always"
}

非常感谢任何帮助!

0 个答案:

没有答案