";“未定义的符号”;对于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)

";“未定义的符号”;对于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),c++,g++,visual-studio-code,gsl,C++,G++,Visual Studio Code,Gsl,我的密码是 #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

我的密码是

#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; 
    }
}

非常感谢任何帮助

编译时,您可能需要链接到
gsl
,例如添加
-lgsl-lgslcblas-lm
以及到
“args”
的正确路径,请参阅。@Holt非常感谢!编译时,您可能需要链接到
gsl
,例如,添加
-lgsl-lgslcblas-lm
以及到
“args”
的正确路径,请参阅。@Holt非常感谢!可能重复的
{
    // 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"
}