2017-08-28 864 views
0

我最近拿起書Beginning C++ Game Programming。我儘可能精確地跟蹤這本書。我是一名具有2年左右的Java開發經驗的人,他正在尋找C++。我認爲在學習遊戲編程的過程中學習它會很有趣。所以我得到的錯誤1>LINK : fatal error LNK1104: cannot open file 'sfml-graphicsd.lib'。我已經將include添加到文件中,我在C++,Linker和Debug項目屬性中添加了include和libs。我將包含代碼,但我還沒有看到正在創建的窗口,但已經出現編譯器錯誤。無法打開文件'sfml-graphicsd.lib'

我注意到,實際的文件名是sfml-graphics-d.lib而編譯器似乎試圖打開sfml-graphicsd.lib。我檢查了我下載的SFML版本,它是Visual C++ 14 (2015) - 32-bit,我正在編譯win32。

代碼:

// Samurai.cpp : Defines the entry point for the console application. 
// 

#include "stdafx.h" 
#include <SFML\Graphics.hpp> 

using namespace sf; 

int main() 
{ 
    VideoMode vm(1920, 1080); 
    Window(vm, "Samurai", Style::Fullscreen); 
    return 0; 
} 

輸出:

1>------ Build started: Project: Samurai, Configuration: Debug Win32 ------ 
1>LINK : fatal error LNK1104: cannot open file 'sfml-graphicsd.lib' 
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== 

enter image description here

請讓我知道是否需要任何進一步的信息。

謝謝大家這麼多,

歐文

+1

您向我們展示的任何文件都沒有名爲'sfml-graphicsd.lib'。您是否在鏈接器設置中輸入了該名稱?此外,這些錯誤是鏈接器錯誤,而不是編譯器錯誤。 – PaulMcKenzie

+0

我沒有,我可以添加屬性窗口的截圖。在'properties> all configs> C++> general'中,額外的include目錄被設置爲C:\ SFML \ include,在'properties> all configs> linker> general'中,額外的libs被設置爲C:\ SFML \ lib和I在'properties> debugs> linker> input'中設置環境變量爲sfml-graphicsd.lib; sfml-window-d.lib; sfml-system-d.lib; sfml-networkd.lib; sfml-audio-d.lib ; –

+0

好的,我發現了錯誤。這是'properties> debugs> linker> input'中的拼寫錯誤,dll文件名中沒有'-' –

回答

0

我發現的錯誤。這是一個拼寫錯誤properties > debugs > linker > input沒有 - 在dll文件名中