我正在学习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"
}
非常感谢任何帮助!