[英]Cannot specify additional link file for clang
I've successfully compiled my main.cpp with clang, specifying additional include path via the command line options as follows: clang++ -I ./Dependencies/GLFW/include/ -S .\\main.cpp
.我已经成功地用 clang 编译了我的 main.cpp,通过命令行选项指定了额外的包含路径,如下所示: clang++ -I ./Dependencies/GLFW/include/ -S .\\main.cpp
。
However, when I try to link it by specifying the additional link library by the following command: clang++ -L ./Dependencies/GLFW/lib/glfw3.lib .\\main.s
it gives me a linker error main-8b7c4e.o : error LNK2019: unresolved external symbol glfwInit referenced in function main
.但是,当我尝试通过以下命令指定附加链接库来链接它时: clang++ -L ./Dependencies/GLFW/lib/glfw3.lib .\\main.s
它给了我一个链接器错误main-8b7c4e.o : error LNK2019: unresolved external symbol glfwInit referenced in function main
。
Any suggestions on what might be wrong?关于可能出什么问题的任何建议? I'm sure that the relative path specified is correct, since the compile command gave me no issues.我确定指定的相对路径是正确的,因为编译命令没有给我任何问题。
main.cpp
#include <iostream>
#include <GLFW/glfw3.h>
int main() {
glfwInit();
std::cout << "Hello world" << std::endl;
return 0;
}
-L
is for specifying folders to search for libraries in. The compiler ignores directories that don't exist. -L
用于指定要在其中搜索库的文件夹。编译器会忽略不存在的目录。
Your command line should be:你的命令行应该是:
clang++ ./Dependencies/GLFW/lib/glfw3.lib .\main.s
Please find below link for more detail about glfw header inclusion.有关 glfw 标头包含的更多详细信息,请参阅以下链接。
https://www.glfw.org/docs/latest/build_guide.html https://www.glfw.org/docs/latest/build_guide.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.