Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

将xmake包的头文件路径添加到intellisense的库路径中 #149

Open
jingkaimori opened this issue Dec 14, 2022 · 6 comments
Open

Comments

@jingkaimori
Copy link

你在什么场景下需要该功能?

某个项目使用了xmake提供的c++依赖,在项目内浏览这个依赖的头文件时intellisense警告称该头文件不存在。

描述可能的解决方案

xmake 插件修改c_cpp_properties.json,添加对应xmake包的头文件。

描述你认为的候选方案

xmake.lua中列出xmake包的包含路径,生成相应的配置文件

其他信息

No response

@waruqi
Copy link
Member

waruqi commented Dec 14, 2022

看下 #40

@jingkaimori
Copy link
Author

项目里有下列依赖:

-- qt is also needed
add_requires("libpng", {system=false})
add_requires("libiconv", {system=false})
add_requires("zlib", {system=false})
add_requires("libjpeg", {system=false})
add_requires("libcurl 7.82.0", {system=false})
add_requires("freetype", {system=false})
add_requires("sqlite3", {system=false})

按照 #40 生成compile_command文件后,大部分头文件都可以识别,只有freetype和libjpeg的头文件无法识别,需要手动添加目录。

@waruqi
Copy link
Member

waruqi commented Dec 14, 2022

自己检查下 .vscode/compile_commands.json 里面的路径

@jingkaimori
Copy link
Author

路径没问题,手动复制到includePath字段下就没问题了

@waruqi
Copy link
Member

waruqi commented Dec 14, 2022

路径没问题,手动复制到includePath字段下就没问题了

路径没问题的话,那就跟 xmake 没啥关系了,xmake 只保证生成正常可用的 compile_commands.json

至于 clangd 还是 cpptools 加载后,部分路径不识别,那是他们的问题,你得给他们提 issues,而不是这里。

@xiaomi2077
Copy link
Contributor

@jingkaimori

路径没问题,手动复制到includePath字段下就没问题了

截屏2023-01-11 15 40 08

在c_cpp_properties.json里指定下compileCommands试试。就不用手动添加includePath了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants