2017-08-28 75 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文件名中