Compiler errors ld:未找到框架sfml

Compiler errors ld:未找到框架sfml,compiler-errors,g++,sfml,Compiler Errors,G++,Sfml,我将框架的内容从SFML复制到~/Library/Frameworks,并尝试在SFML中运行第一个教程示例。 我在g++中使用了这个: g++ -o sfml-test.cpp -framework SFML -lsfml-window 并获取以下错误: ld: framework not found SFML 任何帮助都将不胜感激。首先,本教程指定了/Library/Frameworks,而不是~/Library/Frameworks~指向用户主目录(/Users/name/),而/指向

我将框架的内容从SFML复制到~/Library/Frameworks,并尝试在SFML中运行第一个教程示例。 我在g++中使用了这个:

g++ -o sfml-test.cpp -framework SFML -lsfml-window
并获取以下错误:

ld: framework not found SFML

任何帮助都将不胜感激。

首先,本教程指定了
/Library/Frameworks
,而不是
~/Library/Frameworks
~
指向用户主目录(
/Users/name/
),而
/
指向文件系统上的最低点

另外,
/Library/Frameworks
不是标准的框架目录,因此必须在搜索路径中设置它。通过运行
gcc-Xlinker-v
,可以查看标准框架目录:

@(#)PROGRAM:ld  PROJECT:ld64-409.12
BUILD 17:47:51 Sep 25 2018
configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em arm64e arm64_32
Library search paths:
    /usr/local/lib
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib
Framework search paths:
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/
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)
注意
框架搜索路径
部分,它不包括
/Library/Frameworks

要将
/Library/Frameworks
添加到搜索路径,请使用
-F/Library/Frameworks
编译并链接
-F/Library/Frameworks-SFML-framework-x
,x为
系统
窗口
图形
音频
网络

另外,
-o
选项指定输出文件名。您的命令不会获取任何输入文件并输出可执行文件
sfml test.cpp
,因此使用
-o sfml test sfml test.cpp
sfml test.cpp
作为输入,并输出
sfml test

你的命令是:


g++-o sfml-test sfml-test.cpp-F/Library/Frameworks-framework-sfml-framework-sfml window

我尝试过,但我得到了以下错误:ld:symbol未找到架构x86\u 64 clang:error:linker命令失败,退出代码为1(使用-v查看调用)