2017-12-18 204 views
1

行,所以我第一次尝试检查其他的解决方案,但他们没有工作,是啊...有两个错误,即使我直接从文档中直接看到代码。我想这可能是与文件有问题,但我不认为这会,因为文件都.HPP除非他们是否bad.I是新手所以这可能是一些愚蠢的,我错过了。苹果Mach-O的链接(ID)错误 - 连接命令退出码1失败(使用-v看到调用)C++ SFML

#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; 
} 

语法没有错误,它必须是某种类型的库错误。

UPDATE FOUND答案。还是回答,问的问题,以帮助在其他情况下,他们碰上我做了同样的问题,因为从堆栈溢出所有的方法都不能真正解决这一特定问题

回答

1

行,所以问题不在于你的语法,因为里面这很好。问题在于您可能忘记为sfml添加系统文件,这是它无法正常工作的原因。添加你需要的所有库,包括sfml的系统。 该文件应该看起来像

libsfml-system.2.4.2.dylib 

你需要,否则它将无法正常工作。确保你添加了那个和你需要的其他文件,然后它应该可以工作(它的确如此,这是OP的顺便说明)。

相关问题