2014-06-21 77 views
0

我開始使用2D視頻遊戲編程,並決定使用Eclipse,因爲我習慣了Java開發。我還決定使用SFML,並使用MinGW作爲GCC編譯器爲Eclipse安裝C/C++工具。
我有很多外部庫鏈接和包括的麻煩,但它假設已經修復,因爲我沒有編譯錯誤消息。
現在,當我嘗試編譯和執行任何像這樣的代碼(所有的人都從SFML tutorials直接取):SFML不會啓動窗口

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

有什麼事情發生,它應該推出一個空的窗口...
的配置Eclipse中沒有明確處理的教程,從而使圖書館配置我做是this,我查:

  • C:\ MinGW的\ BIN添加到項目環境PATH。

  • 項目屬性> C/C++構建>設置> MinGW C++鏈接器>庫,從需要他人的庫中直到那些不需要的庫的順序,如教程解釋(sfml-graphics,sfml-window,sfml -系統)。也嘗試過使用sfml-xxx-d庫,仍然無法正常工作。

  • 項目屬性> C/C++構建>工具鏈編輯器>當前構建器= Gnu make Builder。

  • 運行配置>參數>程序參數:-SFML_DYNAMIC

我一直在試圖解決這個問題時4個多小時,所以請我需要幫助,不然我會變得瘋狂?謝謝大家。

回答

0

我沒有解釋,但我有與「調試」庫鏈接相同的問題。我可以通過以「調試」模式啓動應用程序來使其工作。

+0

我終於放棄了SFML。現在我正在使用Cocos2d-x,這比較容易。不管怎樣,謝謝你! – jjimenezg93