2017-12-18 207 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的順便說明)。

相關問題