Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Linking errors in newly built sfml project for visual studio 2013  (Read 6638 times)

0 Members and 1 Guest are viewing this topic.

Mmarzex

  • Newbie
  • *
  • Posts: 8
    • View Profile
Hi so I just built SFML in cmake for visual studio 2013x64. Now When I try to build and everything I get this error.

Code: [Select]
1>------ Build started: Project: sfml_test, Configuration: Debug x64 ------
1>  Microsoft (R) C/C++ Optimizing Compiler Version 18.00.21005.1 for x64
1>  Copyright (C) Microsoft Corporation.  All rights reserved.
1> 
1>  cl /c /IC:\Users\Max\Sandbox\sfml_two\include /Zi /W3 /WX- /sdl /Od /D _MBCS /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"x64\Debug\\" /Fd"x64\Debug\vc120.pdb" /Gd /TP /errorReport:prompt main.cpp
1> 
1>  Skipping... (no relevant changes detected)
1>  main.cpp
1>  Microsoft (R) Incremental Linker Version 12.00.21005.1
1>  Copyright (C) Microsoft Corporation.  All rights reserved.
1> 
1>  "/OUT:c:\users\max\documents\visual studio 2013\Projects\sfml_test\x64\Debug\sfml_test.exe" /INCREMENTAL "/LIBPATH:C:\Users\Max\Sandbox\sfml-build-two\lib\Debug" "sfml-graphics-d.lib" kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST "/MANIFESTUAC:level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG "/PDB:c:\users\max\documents\visual studio 2013\Projects\sfml_test\x64\Debug\sfml_test.pdb" /TLBID:1 /DYNAMICBASE /NXCOMPAT "/IMPLIB:c:\users\max\documents\visual studio 2013\Projects\sfml_test\x64\Debug\sfml_test.lib" /MACHINE:X64 x64\Debug\main.obj
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl sf::String::String(char const *,class std::locale const &)" (__imp_??0String@sf@@QEAA@PEBDAEBVlocale@std@@@Z) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl sf::String::~String(void)" (__imp_??1String@sf@@QEAA@XZ) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (__imp_??0VideoMode@sf@@QEAA@III@Z) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl sf::Window::close(void)" (__imp_?close@Window@sf@@QEAAXXZ) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __cdecl sf::Window::isOpen(void)const " (__imp_?isOpen@Window@sf@@QEBA_NXZ) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __cdecl sf::Window::pollEvent(class sf::Event &)" (__imp_?pollEvent@Window@sf@@QEAA_NAEAVEvent@2@@Z) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl sf::Window::display(void)" (__imp_?display@Window@sf@@QEAAXXZ) referenced in function main
1>c:\users\max\documents\visual studio 2013\Projects\sfml_test\x64\Debug\sfml_test.exe : fatal error LNK1120: 7 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I have never seen something like this so I'm a bit confused as to what it is. Any help would be great.

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Mmarzex

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Linking errors in newly built sfml project for visual studio 2013
« Reply #2 on: December 06, 2013, 04:49:35 pm »
I already followed the tutorial and have looked at everything. It still does not explain to me anything as to why that error has happened.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: Linking errors in newly built sfml project for visual studio 2013
« Reply #3 on: December 06, 2013, 04:51:58 pm »
Did you also make a clean rebuold? Because the given output shows that main.cpp wasn't compiled freshly.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Mmarzex

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Linking errors in newly built sfml project for visual studio 2013
« Reply #4 on: December 06, 2013, 05:11:49 pm »
Yeah I tried cleaning and rebuilding it and it still gave me those errors.

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Linking errors in newly built sfml project for visual studio 2013
« Reply #5 on: December 06, 2013, 06:32:22 pm »
You know.... tutorials and FAQs aren't troubleshooting guides. They don't provide a solution to every possible error that can occur. You should understand them instead and use the knowledge to solve the problem on your own.

It is obvious from your build output that some things are missing that you forgot in your project settings. Your error can easily be solved if you would just take a look at a specific picture on the VC tutorial page (hint: the second picture), or read through the FAQ entry that I linked. I am not going to provide a step by step tutorial here for how to solve your error, because this really belongs to the basics that everybody should know and understand.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Mmarzex

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Linking errors in newly built sfml project for visual studio 2013
« Reply #6 on: December 06, 2013, 07:05:07 pm »
Sorry my lack of expertise has annoyed you. I was just trying to get an understanding of what the problem was. I figured it out though.

On an other note, to get it to run I had to copy sfml-graphics-d-2.dll to my output folder. Should I have to do that?

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Linking errors in newly built sfml project for visual studio 2013
« Reply #7 on: December 06, 2013, 07:40:32 pm »
On an other note, to get it to run I had to copy sfml-graphics-d-2.dll to my output folder. Should I have to do that?

We seriously don't tell you to read the tutorials for nothing....

To quote from the link binary1248 kindly provided.

Quote from: SFML TUTORIALS
if you linked to the dynamic version of SFML, don't forget to copy the SFML DLLs (they are in <sfml-install-path/bin>) to the directory where your compiled executable is.
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

Mmarzex

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Linking errors in newly built sfml project for visual studio 2013
« Reply #8 on: December 06, 2013, 10:13:41 pm »
I greatly understand why you link to tutorials and everything. I also am saying though that you don't have to get angry or annoyed at a question. That doesn't give a very nice community feel. I asked a question and instead you link me to something that I have already looked at. I don't post on a forum if I haven't already looked at things. I simply made a mistake that as a new sfml user didn't understand but clearly binary1248 did but instead of giving me an answer just sends me to look at what I already did. You shouldn't get annoyed for a person asking a question.

Thanks for your help, I'll make sure I just aimlessly click through the wiki and documentation so I don't bother anyone with questions.

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Linking errors in newly built sfml project for visual studio 2013
« Reply #9 on: December 06, 2013, 10:36:56 pm »
What is the difference between us telling you here what to do or us telling you to go read something you think you fully read but obviously didn't? Almost no difference.

There is a reason we tell you to read those things over and over... it's because the answer is in it, and it isn't that hard to find the answer either, compared to some other documents. If you are unable to read it or fully understand it because maybe English isn't a language you can speak well, then say so and maybe someone can explain it to you in your native language. Otherwise, the only difference between seeing the answer here and seeing it in the tutorial is that we do the searching for you, and that is clearly not the way to learn how to solve problems on your own. If you want to learn how to use SFML, at least learn to solve problems on your own first, it is much easier than learning how to use SFML and it will help you a lot in the future.

Don't get me wrong, even I was a beginner once, and there is nothing wrong with being one. What matters is whether you are willing to invest effort into learning new things. As with all things technical, learning to help yourself is always the first step, and many people seem to forget that or simply don't care. It is those kind of people that I also don't care about because they are just a waste of my time. All forum contributors post in their free time, so it makes sense that we want to maximize the effect of our posts. Even if it hurts in the beginning, it is better in the long run because potentially less questions will be asked since people have learnt to help themselves better.

We all went to school, and as an adult, none of us can truly say it was a waste of time although as children some may have considered it a waste of time not understanding the long term goal.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).