SFML community forums
Help => General => Topic started by: Tommex on August 19, 2018, 02:43:41 pm
-
Hey guys, it's my first time posting here something basically because of an issue that i'm getting on building my project.
I installed SFML 2 days ago and followed a video of how to setup it. now, when i'm trying to build the next 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;
}
I'm keeping getting an Linker Error LNK2019 and LNK1120.
Here is the build error:
Severity Code Description Project File Line Suppression State
Error LNK2001 unresolved external symbol "public: static class sf::RenderStates const sf::RenderStates::Default" (?Default@RenderStates@sf@@2V12@B) SFML_TEST C:\Users\User\source\repos\SFML_TEST\SFML_TEST\Main.obj 1
Severity Code Description Project File Line Suppression State
Error LNK2001 unresolved external symbol "public: static class sf::Color const sf::Color::Green" (?Green@Color@sf@@2V12@B) SFML_TEST C:\Users\User\source\repos\SFML_TEST\SFML_TEST\Main.obj 1
Severity Code Description Project File Line Suppression State
Error LNK1120 2 unresolved externals SFML_TEST C:\Users\User\source\repos\SFML_TEST\x64\Debug\SFML_TEST.exe 1
Here are my properties to the project, hope it helped finding my problem:
https://imgur.com/a/cIHgOZL
-
Why did you define SFML_STATIC? ;)
-
I just followed the instructions.
Well, i removed it and now i can build it. but now it shows me another errors about my .lib i think :\
https://imgur.com/a/M5VQhmJ
-
No, the instructions tell you something else. Please read them carefully and don't just look at the images. ;)
-
I did everything okay, still getting the error about the dll, what should i do with it?
https://imgur.com/a/M5VQhmJ
-
It's mentioned in the tutorial:
don't forget to copy the SFML DLLs (they are in <sfml-install-path/bin>) to the directory where your compiled executable is
-
Perfecto!! ;D
Problem was solved.
Thank you very much, i hope you helped here not only to my, but for more people that had this issue. ;)
https://imgur.com/a/OHYsJy0