每当我尝试链接库时,都会收到错误

Whenever I try to link a library I get an error

本文关键字:错误 链接      更新时间:2023-10-16

我正在尝试学习FLTK C++并且我正在使用clang++编译器开发Macbook。每当我尝试像这样链接库时:

clang++ -L/usr/local/lib -lfltk

它给了我这个错误:

 clang: warning: argument unused during compilation: '-X11'
Undefined symbols for architecture x86_64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我已经查看了其他几个论坛,了解如何解决此问题,但没有得到任何有效的答案。我还尝试从Apple的开发人员站点重新安装命令行工具。

您必须确保在执行filename.cpp -o Exectuable之前放置链接器命令(-L/usr/local/lib -lfltk),但仍在命令行中的同一行中。

相关文章: