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

Author Topic: [Visual Studio 2012] [SMFL-2.0] Unresolved External Symbol  (Read 4321 times)

0 Members and 1 Guest are viewing this topic.

Harris

  • Newbie
  • *
  • Posts: 3
    • View Profile
IED: Visual Studio Express 2012 - 64bit
SMFL Version: 2.0 - Visual C++ 11 (2012) - 64 bits

Previously, I had a development version of SFML - 2.0 working with VS 2012 by using CMake, but the new version of SFML does not contain CMakeList.txt and should support VS 2012 by default.

I followed the instructions perfectly. I have everything statically linked correctly, I tried dynamically linking, but recieved the same errors. I have looked over the forums and have tried several things to try and fix this. Please help.

#include <SFML/Graphics.hpp>
#include <iostream>

int main()
{
        sf::RenderWindow window(sf::VideoMode(800, 600), "Game");

        while(window.isOpen())
        {
                sf::Event event;

                while(window.pollEvent(event))
                {
                        if(event.type == sf::Event::Closed)
                        {
                                window.close();
                        }
                }

                window.display();

                window.clear();
        }

        return 0;
}
 

Error   1       error LNK2019: unresolved external symbol "public: __thiscall sf::String::String(char const *,class std::locale const &)" (??0String@sf@@QAE@PBDABVlocale@std@@@Z) referenced in function _main C:\Users\Harris\documents\visual studio 2012\Projects\Game\Game\Main.obj        Game
Error   2       error LNK2019: unresolved external symbol "public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (??0VideoMode@sf@@QAE@III@Z) referenced in function _main       C:\Users\Harris\documents\visual studio 2012\Projects\Game\Game\Main.obj        Game
Error   3       error LNK2019: unresolved external symbol "public: void __thiscall sf::Window::close(void)" (?close@Window@sf@@QAEXXZ) referenced in function _main     C:\Users\Harris\documents\visual studio 2012\Projects\Game\Game\Main.obj        Game
Error   4       error LNK2019: unresolved external symbol "public: bool __thiscall sf::Window::isOpen(void)const " (?isOpen@Window@sf@@QBE_NXZ) referenced in function _main    C:\Users\Harris\documents\visual studio 2012\Projects\Game\Game\Main.obj        Game
Error   5       error LNK2019: unresolved external symbol "public: bool __thiscall sf::Window::pollEvent(class sf::Event &)" (?pollEvent@Window@sf@@QAE_NAAVEvent@2@@Z) referenced in function _main    C:\Users\Harris\documents\visual studio 2012\Projects\Game\Game\Main.obj        Game
Error   6       error LNK2019: unresolved external symbol "public: void __thiscall sf::Window::display(void)" (?display@Window@sf@@QAEXXZ) referenced in function _main C:\Users\Harris\documents\visual studio 2012\Projects\Game\Game\Main.obj        Game
Error   7       error LNK2019: unresolved external symbol "public: __thiscall sf::Color::Color(unsigned char,unsigned char,unsigned char,unsigned char)" (??0Color@sf@@QAE@EEEE@Z) referenced in function _main C:\Users\Harris\documents\visual studio 2012\Projects\Game\Game\Main.obj        Game
Error   8       error LNK2019: unresolved external symbol "public: void __thiscall sf::RenderTarget::clear(class sf::Color const &)" (?clear@RenderTarget@sf@@QAEXABVColor@2@@Z) referenced in function _main   C:\Users\Harris\documents\visual studio 2012\Projects\Game\Game\Main.obj        Game
Error   9       error LNK2019: unresolved external symbol "public: __thiscall sf::RenderWindow::RenderWindow(class sf::VideoMode,class sf::String const &,unsigned int,struct sf::ContextSettings const &)" (??0RenderWindow@sf@@QAE@VVideoMode@1@ABVString@1@IABUContextSettings@1@@Z) referenced in function _main    C:\Users\Harris\documents\visual studio 2012\Projects\Game\Game\Main.obj        Game
Error   10      error LNK2019: unresolved external symbol "public: virtual __thiscall sf::RenderWindow::~RenderWindow(void)" (??1RenderWindow@sf@@UAE@XZ) referenced in function _main  C:\Users\Harris\documents\visual studio 2012\Projects\Game\Game\Main.obj        Game
Error   11      error LNK1120: 10 unresolved externals  C:\Users\Harris\documents\visual studio 2012\Projects\Game\Debug\Game.exe       Game
 

This is the exactly same code I have used in the development versions of SFML - 2.0 which worked perfectly.

If I am missing something or there is a really easy fix that I cannot see than I apologize, but I would really like to get this setup and working.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: [Visual Studio 2012] [SMFL-2.0] Unresolved External Symbol
« Reply #1 on: May 07, 2013, 11:52:30 pm »
I followed the instructions perfectly. I have everything statically linked correctly, I tried dynamically linking, but recieved the same errors. I have looked over the forums and have tried several things to try and fix this.
Make sure that SFML_STATIC isn't defined when linking dynamically.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Raphman

  • Newbie
  • *
  • Posts: 40
    • View Profile
    • Email
Re: [Visual Studio 2012] [SMFL-2.0] Unresolved External Symbol
« Reply #2 on: May 07, 2013, 11:54:00 pm »
If what eXpl0it3er said wasn't the problem, maybe you could try  using the precompiled binaries?

Harris

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: [Visual Studio 2012] [SMFL-2.0] Unresolved External Symbol
« Reply #3 on: May 08, 2013, 12:00:56 am »
SFML_STATIC is not the problem I have used it correctly. Thank you for the idea.

Harris

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: [Visual Studio 2012] [SMFL-2.0] Unresolved External Symbol
« Reply #4 on: May 08, 2013, 03:56:26 am »
I found my error. Please remove this thread.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: [Visual Studio 2012] [SMFL-2.0] Unresolved External Symbol
« Reply #5 on: May 08, 2013, 06:13:54 am »
Threads are not removed when the problem is solved. Instead, you could state how you solved the problem, for people that stumble across this thread in the future ;)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: [Visual Studio 2012] [SMFL-2.0] Unresolved External Symbol
« Reply #6 on: May 08, 2013, 07:25:42 am »
Threads are not removed when the problem is solved. Instead, you could state how you solved the problem, for people that stumble across this thread in the future ;)
You have very high expectations. Judging from the threads that are started all the time, either they don't go to page 2 or they couldn't find the search button. I've tried to minimize this by writing a more or less useful FAQ, but since I can't tell how many people view it, I can't determine if it is directly correlated to the decline of questions that were answered several days in the past.

Also, I assume Harris attributed his problem to something that is not specific to SFML or programming in general and as such didn't deem the solution worthy to be written down here.

Still, I agree that the thread shouldn't be deleted, but a forum really isn't the right place for anything other than discussions that are useful to everybody. This of course assuming that people actually care to read what has been written ;).
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

thegooseking

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: [Visual Studio 2012] [SMFL-2.0] Unresolved External Symbol
« Reply #7 on: May 08, 2013, 11:22:07 am »
If what eXpl0it3er said wasn't the problem, maybe you could try  using the precompiled binaries?

It sounds like he was using the precompiled binaries (since he said the new version would support VS2012 "by default"). My guess would be that because he has a 64-bit development environment, he was trying to build a 32-bit application against 64-bit libraries, which won't work.

For anyone else having this problem, it's worth remembering when you download the libraries that the Visual Studio x (or whatever) part refers to your development platform, but the 32-bit vs. 64-bit refers to your target platform. Your development platform is probably (these days) 64-bit, but your target platform is still likely to be 32-bit unless you have a special reason to need a 64-bit program, so download the 32-bit binaries. (It's worth noting that neither the official tutorial nor any unofficial tutorial I've seen mentions this - maybe it's supposed to be obvious?)

At least, I was having this problem (though on VS2008) when I was stupidly using 64-bit binaries, and it went away when I switched to 32-bit binaries, so I guess that was the reason, although you would more expect this problem in that case.
« Last Edit: May 08, 2013, 12:24:59 pm by thegooseking »

 

anything