2015-02-23 24 views
1

我剛剛決定嘗試理解C++的GUI用戶界面,並發現SFML對初學者非常有用。 我也使用CodeBlocks二進制版本(我猜) 我找到了一個教程,展示瞭如何將SFML庫鏈接到代碼塊。 我完全按照它。undefined refrence to'__imp___ ..'SFML C++庫

了他們的示例程序,試圖建立它(編譯就好了)

,我得到了20個錯誤

enter image description here

這是代碼:

#include <SFML/Graphics.hpp> 

int main() 
{ 
    sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!"); 
    sf::CircleShape shape(100.f); 
    shape.setFillColor(sf::Color::Green); 

    while (window.isOpen()) 
    { 
     sf::Event event; 
     while (window.pollEvent(event)) 
     { 
      if (event.type == sf::Event::Closed) 
       window.close(); 
     } 

     window.clear(); 
     window.draw(shape); 
     window.display(); 
    } 

    return 0; 
} 

而這些是我所做的更改:

enter image description here

我從來沒有與這些事情合作過,而且我處於完全喪失狀態。 對不起,也許是一個不適當的問題,但我找不到任何相關的答案,我的問題呢。

回答

0

你需要它連接設置鏈接 -lsfml圖形 -lsfml窗口 -lsfml系統

嘗試使用那些代碼塊未定義的引用通常是一個鏈接錯誤

0

我想你沒有正確鏈接。

檢查出this official tutorial並仔細閱讀(特別是紅色框)。

如果您在使用SFML_STATIC時滾動到底部列出所有其他必需的依賴關係,還有一個表。