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

Author Topic: Help with Linking Error..  (Read 8266 times)

0 Members and 1 Guest are viewing this topic.

Sanction

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Help with Linking Error..
« on: October 07, 2014, 04:11:51 am »
Okay so I have played with SFML2.0 be for in the past on my old Computer so its not like this is new to me..
 But I I'm still new to Computer Programming and I did just get this SFML Game Development Book.

I'm running on my brand new Computer w/ Windows 8.1 64bit running VS2013..
I just made a cMake build from 2.1sources (can't create static libs because it won't load them to compile fuk idk) so I linked the libs Dynamicly ..


My Error..
Quote
1>------ Build started: Project: SFML2.1_Test, Configuration: Debug Win32 ------
1>main.obj : error LNK2001: unresolved external symbol "public: static class sf::Color const sf::Color::Green" (?Green@Color@sf@@2V12@B)
1>main.obj : error LNK2001: unresolved external symbol "public: static class sf::RenderStates const sf::RenderStates::Default" (?Default@RenderStates@sf@@2V12@B)
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
1>C:\Users\Matthew\Desktop\VS13 Projects\SFML2.1_Test\Debug\SFML2.1_Test.exe : fatal error LNK1120: 3 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Would this work?> http://en.sfml-dev.org/forums/index.php?topic=13010.0
« Last Edit: October 07, 2014, 05:11:29 am by Sanction »
Knowledge comes, but wisdom lingers. It may not be difficult to store up in the mind a vast quantity of facts within a comparatively short time, but the ability to form judgments requires the severe discipline of hard work and the tempering heat of experience and maturity.

didii

  • Full Member
  • ***
  • Posts: 122
    • View Profile
Re: Help with Linking Error..
« Reply #1 on: October 07, 2014, 05:17:59 am »
The linker is what tries to match a function call with a function definition. Most linker errors you will run into is often due to the fact that it can't find the definition. This is mostly because you forgot to include some files, or forgot to link some libraries. Since your error states that it cannot find sf::Color::Green and sf::RenderStates::Default, which are from SFML, it's probably because you did not link the SFML library correctly.

As for how to link it correctly, read the tutorial.

The third linker error (about MSVCRTD.lib) is not SFML related and can be easily googled ;)

Sanction

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Re: Help with Linking Error..
« Reply #2 on: October 07, 2014, 05:38:06 am »
Well I'm getting somewhere lol.. that solves one problem..  Now I followed this step by step and I've also linked this be for in the past.. this time around tho I'm using VS2013.. and I have to create a new SFML 2.1 lib with cMake..  now I've also did this in the past be for also I had no Problems making the Dynamic libs.. but I did run into a problem creating the static lib(I thought I read somewhere that I need dll files).. so what I did was set it up Dynami?  I'm still getting the LNK ERROR 2001
Knowledge comes, but wisdom lingers. It may not be difficult to store up in the mind a vast quantity of facts within a comparatively short time, but the ability to form judgments requires the severe discipline of hard work and the tempering heat of experience and maturity.

Sanction

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Re: Help with Linking Error..
« Reply #3 on: October 07, 2014, 07:52:37 am »
Well I've been up all night trying to figure it out.. I have no clue what I did wrong.. Tomorrow I will start completely over for a fresh start..

Do you have to have extra DLL Files for the new SFML 2.1?
Knowledge comes, but wisdom lingers. It may not be difficult to store up in the mind a vast quantity of facts within a comparatively short time, but the ability to form judgments requires the severe discipline of hard work and the tempering heat of experience and maturity.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11033
    • View Profile
    • development blog
    • Email
AW: Help with Linking Error..
« Reply #4 on: October 07, 2014, 07:58:34 am »
The error from the first post usually occurs when you mix debug and release libraries. When you are in debug mode you need to link against the libraries with the -d suffix. In release mode you need to link the libraries without any suffix.

It all comes down to following the official tutorial in every detail, don't jump and assume and don't just look at the images. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Sanction

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Re: Help with Linking Error..
« Reply #5 on: October 07, 2014, 08:58:37 am »
This is my current setup:  VS2013, Windows 8.1

My Build I made with cMake:
C:\Users\Matthew\Documents\SFML-2.1 2013Build\lib\(libFiles)<-I have Release and Debug lib in the same folder idk if this matters?
C:\Users\Matthew\Documents\SFML-2.1 2013Build\include\SFML\(HeaderFiles)

VS2013 Project Property Configuration:
(click to show/hide)




« Last Edit: October 07, 2014, 09:04:54 am by Sanction »
Knowledge comes, but wisdom lingers. It may not be difficult to store up in the mind a vast quantity of facts within a comparatively short time, but the ability to form judgments requires the severe discipline of hard work and the tempering heat of experience and maturity.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11033
    • View Profile
    • development blog
    • Email
Re: Help with Linking Error..
« Reply #6 on: October 07, 2014, 09:06:43 am »
Are you still getting the errors you've written in the first post, even after a clean rebuild?

Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Sanction

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Re: Help with Linking Error..
« Reply #7 on: October 07, 2014, 09:26:49 am »
Yeah, I've did it 3 times.. I'm stumped.. There is something I'm doing that I'm not seeing
Knowledge comes, but wisdom lingers. It may not be difficult to store up in the mind a vast quantity of facts within a comparatively short time, but the ability to form judgments requires the severe discipline of hard work and the tempering heat of experience and maturity.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11033
    • View Profile
    • development blog
    • Email
Re: Help with Linking Error..
« Reply #8 on: October 07, 2014, 09:33:57 am »
Ah, did you by any chance define SFML_STATIC? If you build dynamically you shouldn't do that. ;)

Also the WinMain issue, is probably because you set the subsystem to window. If you did set it to window you need to link against sfml-main as well. For debugging I however advise to let the console active, so you can output things and read SFML's error output there.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Sanction

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Re: Help with Linking Error..
« Reply #9 on: October 07, 2014, 09:49:33 am »
I fixed the WinMain issue.. and yes.. I thought I took out the SFML_STATIC because I had to change back from static... for some reason I can't build Static libs....  I switched Release out but not Debug.. so that fix the error I was getting... but now I'm getting another about missing DLL files

New Error..
(click to show/hide)
Knowledge comes, but wisdom lingers. It may not be difficult to store up in the mind a vast quantity of facts within a comparatively short time, but the ability to form judgments requires the severe discipline of hard work and the tempering heat of experience and maturity.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11033
    • View Profile
    • development blog
    • Email
AW: Help with Linking Error..
« Reply #10 on: October 07, 2014, 09:55:02 am »
Did you copy the DLLs next to your executable?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Sanction

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Re: Help with Linking Error..
« Reply #11 on: October 07, 2014, 10:02:53 am »
Yeah I copied the DLLs from the bin folder and put them in my project folder
Knowledge comes, but wisdom lingers. It may not be difficult to store up in the mind a vast quantity of facts within a comparatively short time, but the ability to form judgments requires the severe discipline of hard work and the tempering heat of experience and maturity.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11033
    • View Profile
    • development blog
    • Email
Re: Help with Linking Error..
« Reply #12 on: October 07, 2014, 10:08:34 am »
Where exactly in your project directory?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Sanction

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Re: Help with Linking Error..
« Reply #13 on: October 07, 2014, 10:15:41 am »
I figured it out!! So I was missing DLL files and was still trying to SFML_STATIC
« Last Edit: October 07, 2014, 10:23:36 am by Sanction »
Knowledge comes, but wisdom lingers. It may not be difficult to store up in the mind a vast quantity of facts within a comparatively short time, but the ability to form judgments requires the severe discipline of hard work and the tempering heat of experience and maturity.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11033
    • View Profile
    • development blog
    • Email
Re: Help with Linking Error..
« Reply #14 on: October 07, 2014, 10:22:32 am »
If your debug build is looking for sfml-graphics-2.dll, then you've built it wrong somehow, because the debug DLL would be sfml-graphics-d-2.dll.

You need to link against sfml-main for release if you use the window subsystem.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/