我下载了 fftw3 tar 文件并解压缩并配置了它,并在 ~/usr/include/中进行了 make 和 make install
现在我写了一个简单的代码
#include<iostream>
#include <fftw3.h>
int main()
{
fftw_complex *T=(fftw_complex *)fftw_malloc(sizeof(fftw_complex)*5*5);
return 0;
}
然后我去了vs code的c_cpp_properties.json文件,更新了
{
"configurations": [
{
"name": "Mac",
"includePath": [
"/usr/include",
"/usr/local/include",
"${workspaceRoot}"
],
"defines": [],
"intelliSenseMode": "clang-x64",
"browse": {
"path": [
"/usr/include",
"/usr/local/include",
"${workspaceRoot}"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"macFrameworkPath": [
"/System/Library/Frameworks",
"/Library/Frameworks"
]
},
{
"name": "Linux",
"includePath": [
"/usr/include/c++/5",
"/usr/include/x86_64-linux-gnu/c++/5",
"/usr/include/c++/5/backward",
"/usr/lib/gcc/x86_64-linux-gnu/5/include",
"/usr/local/include",
"/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed",
"/usr/include/x86_64-linux-gnu",
"/usr/include",
"~/usr/include/",
"${workspaceRoot}"
],
"defines": ["_DEBUG"],
"intelliSenseMode": "clang-x64",
"browse": {
"path": [
"/usr/include/c++/5",
"/usr/include/x86_64-linux-gnu/c++/5",
"/usr/include/c++/5/backward",
"/usr/lib/gcc/x86_64-linux-gnu/5/include",
"/usr/local/include",
"/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed",
"/usr/include/x86_64-linux-gnu",
"/usr/include",
"~/usr/include/",
"${workspaceRoot}"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
},
{
"name": "Win32",
"includePath": [
"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include",
"${workspaceRoot}"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"intelliSenseMode": "msvc-x64",
"browse": {
"path": [
"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include/*",
"${workspaceRoot}"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
}
],
"version": 3
你可以看到我添加了链接到 ~/usr/include在包含路径部分
现在还是报错
/tmp/ccBhp7Pq.o: In function `main':
Source1.cpp:(.text+0x11): undefined reference to `fftw_malloc'
collect2: error: ld returned 1 exit status
不知道现在该怎么办。在 ubuntu 16.04 中运行
我是一名优秀的程序员,十分优秀!