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

如何设置clang编译参数 #16

Open
hehefox opened this issue Apr 16, 2024 · 3 comments
Open

如何设置clang编译参数 #16

hehefox opened this issue Apr 16, 2024 · 3 comments

Comments

@hehefox
Copy link

hehefox commented Apr 16, 2024

在根目录CmakeList.text中设置了set(CMAKE_C_COMPILER "clang")、set(CMAKE_CXX_COMPILER "clang++"),结果编译不过
是否设置有错误?

@Jackarain
Copy link
Owner

不是很建议通过修改 CMakeLists.txt 来指定编译器.

推荐使用环境变量 CC=clang CXX=clang++ 来指定编译器.
一个示例, 在项目目录中执行:

CC=clang CXX=clang++ cmake -S . -B build -DCMAKE_BUILD_TYPE=Release

@hehefox
Copy link
Author

hehefox commented Apr 26, 2024

谢谢您的回复。按照你的意见设置编译,一样会出现错误。
proxy/proxy/include/proxy/logging.hpp:15:10: fatal error: 'version' file not found
#include
^~~~~~~~~
是不是clang对于libstdc++的支持有问题?
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc")

@Jackarain
Copy link
Owner

proxy/proxy/include/proxy/logging.hpp:15:10: fatal error: 'version' file not found

出现这个错误, 很可能是你的编译环境有问题, <version> 这个是 c++ 标准库的头文件, 不应该找不到.

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

No branches or pull requests

2 participants