-2

抽象的

从llvm下载页面安装coc-clangd并下载clangd后,我创建了,收到以下警告test.cpp

'iostream' file not found
 [clang: pp_file_not_found]

$ clang++ test.cpp --target=x86_64-w64-mingw32当我尝试a.exe正常时

$ clang test.cpp --target=x86_64-w64-mingw32获得以下信息

C:\Users\EASTAR~1\AppData\Local\Temp\test-ce024f.o:test.cpp:(.text+0xc): undefined reference to `std::ios_base::Init::Init()'
C:\Users\EASTAR~1\AppData\Local\Temp\test-ce024f.o:test.cpp:(.text+0x3c): undefined reference to `std::ios_base::Init::~Init()'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

一些命令信息

$ g++ -v
......
Target: x86_64-w64-mingw32

$ clang -v
clang version 11.0.0
Target: i686-pc-windows-msvc
Thread model: posix
InstalledDir: P:\Dev\LLVM\bin

$ clangd --version
clangd version 11.0.0

$ vim --version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled May 23 2021 07:26:32)
Included patches: 1-2859
Compiled by <https://www.msys2.org/>
Huge version without GUI.
......

添加 compile_flags.txt

阅读本指南后,我做了一些更改,但它不起作用

$ ls -a
./  ../  compile_flags.txt  test.cpp
$ cat compile_flags.txt
--target=x86_64-w64-mingw32

此外,我尝试添加 "clangd.arguments": [ "--query-driver=P:\\Dev\\Vim\\MinGW\\mingw64\\bin\\g++.exe" ]coc-settings.json也失败了。

期望

我所需要的只是导入标准库头文件,如iostream, algorithm, queue ...

感谢回复

4

0 回答 0