Apple Mach-O链接器(id)错误 - 链接器命令失败,退出代码为1(使用-v查看调用)C ++ SFML

知是行的主意,行是知的功夫。这篇文章主要讲述Apple Mach-O链接器(id)错误 - 链接器命令失败,退出代码为1(使用-v查看调用)C ++ SFML相关的知识,希望能为你提供帮助。
好的,所以我首先尝试检查其他解决方案,但没有一个工作,是的...有两个错误,即使我直接从文档中遵循代码。我认为这可能是文件的问题,但我认为不会,因为文件都是.hpp,除非它们是坏的。我是新手,所以这可能是我错过的愚蠢。

#include < iostream> #include < SFML/Graphics.hpp> int main() { // create the window sf::RenderWindow window(sf::VideoMode(800, 600), "My window"); // run the program as long as the window is open while (window.isOpen()) { // check all the window's events that were triggered since the last iteration of the loop sf::Event event; while (window.pollEvent(event)) { // "close requested" event: we close the window if (event.type == sf::Event::Closed) window.close(); }// clear the window with black color window.clear(sf::Color::Black); // draw everything here... // window.draw(...); // end the current frame window.display(); }return 0; }

语法没有错误,它必须是某种库错误。
更新找到答案。仍然回答并提出问题以帮助其他人,以防他们遇到我遇到的同样问题,因为堆栈溢出的所有解决方案都不是这个特定问题的真正解决方案
答案好的,所以问题不在你的语法中,因为它非常好。问题是你可能忘了为sfml添加系统文件,这就是它无法正常工作的原因。添加所需的所有库,包括sfml的系统库。该文件应该是这样的
libsfml-system.2.4.2.dylib

【Apple Mach-O链接器(id)错误 - 链接器命令失败,退出代码为1(使用-v查看调用)C ++ SFML】你需要它,否则它将无法工作。确保你添加了那个和你需要的其他文件然后它应该工作(它确实。这是OP BTW。)。

    推荐阅读