2

I am getting the error shown below when I try to compile my project in Visual C++ (Visual Studio 2013).

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

I am very much new Visual Studio, so I used the tutorials here and here to set up the dependencies and everything.

At the top of my file, I have the following headers included:

#include <sfml.h>

The file sfml.h contains the following:

#pragma once
#ifndef SFMLFULL_INCLUDED
#define SFMLFULL_INCLUDED

#define SFML_STATIC

#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/OpenGL.hpp>
#include <SFML/Network.hpp>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>

#if defined(_DEBUG) || defined(DEBUG)
    #pragma comment(lib,"sfml-graphics-s-d.lib")
    #pragma comment(lib,"sfml-audio-s-d.lib")
    #pragma comment(lib,"sfml-network-s-d.lib")
    #pragma comment(lib,"sfml-window-s-d.lib")
    #pragma comment(lib,"sfml-system-s-d.lib")
    #pragma comment(lib,"sfml-main-d.lib")
#else
    #pragma comment(lib,"sfml-graphics-s.lib")
    #pragma comment(lib,"sfml-audio-s.lib")
    #pragma comment(lib,"sfml-network-s.lib")
    #pragma comment(lib,"sfml-window-s.lib")
    #pragma comment(lib,"sfml-system-s.lib")
    #pragma comment(lib,"sfml-main.lib")
#endif

#endif // SFMLFULL_INCLUDED

That file is located at ..\SFML-2.3\include\sfml.h.

The screenshot below shows the location of the sfml-graphics-s-d.lib file:

Screenshot

Can someone please explain what I'm missing here? If there is any further information you need, please just let me know and I'll do my best to provide it.

Edit: Based on the information here I have tried several things including completely restarting my computer, but the project still won't compile.

Community
  • 1
  • 1
tlewis3348
  • 424
  • 2
  • 7
  • 21
  • Are you mixing 32 and 64 bit? – drescherjm Jun 12 '15 at 18:51
  • I don't know. How do I find out? – tlewis3348 Jun 12 '15 at 18:51
  • Visual Studio will tell you what type of application you are building in the GUI also the Output tab looking at the build x64 = 64 bit. Win32 = 32 bit. – drescherjm Jun 12 '15 at 18:53
  • I just added the full output to the OP. It is showing Win32 there, and my system is a 64 bit system. What do I need to change to fix this? – tlewis3348 Jun 12 '15 at 18:57
  • I see you are building a 32 bit application. Did you download the 32 bit sfml libraries for Visual Studio 2013? The 64 bit libs are no good for a 32 bit application. – drescherjm Jun 12 '15 at 18:57
  • I don't remember for sure which one I downloaded. Is there a way to tell by looking at the source code? – tlewis3348 Jun 12 '15 at 19:00
  • I am not familiar with sfml so I can not tell you that. I did check to see there are 32 and 64 bit downloads for each of the supported compilers here: http://www.sfml-dev.org/download/sfml/2.3/ – drescherjm Jun 12 '15 at 19:01
  • Okay. I should be able to download the 32 bit version though and replace what I have with that, correct? – tlewis3348 Jun 12 '15 at 19:03
  • Actually, I just looked at chrome://downloads/ and saw that it was the 32 bit version that I downloaded. – tlewis3348 Jun 12 '15 at 19:05
  • I assume from your links above you are generating your Visual Studio project using CMake. Maybe you should look at the project settings ->Linker -> Additional Library Directories to verify that the correct path to sfml is in there. – drescherjm Jun 12 '15 at 19:10
  • @drescherjm I am generating my project using CMake. According to step #9 in the first link, I'm not adding anything to the project settings --> Linker --> Additional Library Directories. In fact, I'm not really even entirely sure whether it's correct to say that I'm generating my project with CMake since I generated a "setup" project and the settings I entered there are persisting as I create more projects. Having said all that, I did check and the paths entered according to the instructions in step #9 were entered correctly. – tlewis3348 Jun 12 '15 at 19:58

0 Answers0