G
G
Gotenks2019-01-10 21:54:27
C++ / C#
Gotenks, 2019-01-10 21:54:27

What to do if the linker swears?

the code
#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;
}
project settings screenshots
5c3774679c9c2166958393.jpeg5c3774724f09d763404812.jpeg5c37747a12f66659349924.jpeg
compiler output
1>------ Сборка начата: проект: Game1, Конфигурация: Debug Win32 ------
1>pch.cpp
1>Game1.cpp
1>Game1.obj : error LNK2001: неразрешенный внешний символ ""public: static class sf::RenderStates const sf::RenderStates::Default" ([email protected]@[email protected]@[email protected])"
1>Game1.obj : error LNK2001: неразрешенный внешний символ ""public: static class sf::Color const sf::Color::Green" ([email protected]@[email protected]@[email protected])"
1>E:\CPP\Game1\Debug\Game1.exe : fatal error LNK1120: неразрешенных внешних элементов: 2
1>Сборка проекта "Game1.vcxproj" завершена с ошибкой.
========== Сборка: успешно: 0, с ошибками: 1, без изменений: 0, пропущено: 0 ==========

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
Gotenks, 2019-01-11
@Gotenks

In short, everything works for me, the problem was as follows: the
linker tried to find dll files that are in the SFML / bin folder, copy-paste all files from there to the project directory

screen
5c388ff7b1c6d997817914.jpeg

P
pfemidi, 2019-01-11
@pfemidi

Well, there it is clearly and clearly even written in Russian that
@Gotenks , are you going to ask questions for every sneeze?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question