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

Author Topic: Can't get SFML 2.1 to work in Visual Studio 2012  (Read 7642 times)

0 Members and 1 Guest are viewing this topic.

TheRabbit

  • Newbie
  • *
  • Posts: 26
    • View Profile
Can't get SFML 2.1 to work in Visual Studio 2012
« on: October 21, 2013, 12:03:35 am »
Hi,

Im brand new to SFML, and I can't figure it out. I tried following this tutorial to get everything set up:

http://www.cplusplus.com/forum/beginner/95295/#msg511542

I followed it to the letter (except for the Doxygen part), and I'm getting 31 unresolved externals linking errors.

First, I created a brand new blank c++ project. I put examples/window/window.cpp into the project and tried to build:

1>  Source.cpp
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: float __thiscall sf::Time::asSeconds(void)const " (__imp_?asSeconds@Time@sf@@QBEMXZ) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Clock::Clock(void)" (__imp_??0Clock@sf@@QAE@XZ) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class sf::Time __thiscall sf::Clock::getElapsedTime(void)const " (__imp_?getElapsedTime@Clock@sf@@QBE?AVTime@2@XZ) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::String::String(char const *,class std::locale const &)" (__imp_??0String@sf@@QAE@PBDABVlocale@std@@@Z) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::String::~String(void)" (__imp_??1String@sf@@QAE@XZ) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (__imp_??0VideoMode@sf@@QAE@III@Z) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Window::Window(class sf::VideoMode,class sf::String const &,unsigned int,struct sf::ContextSettings const &)" (__imp_??0Window@sf@@QAE@VVideoMode@1@ABVString@1@IABUContextSettings@1@@Z) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::Window::~Window(void)" (__imp_??1Window@sf@@UAE@XZ) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::close(void)" (__imp_?close@Window@sf@@QAEXXZ) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall sf::Window::isOpen(void)const " (__imp_?isOpen@Window@sf@@QBE_NXZ) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall sf::Window::pollEvent(class sf::Event &)" (__imp_?pollEvent@Window@sf@@QAE_NAAVEvent@2@@Z) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class sf::Vector2<unsigned int> __thiscall sf::Window::getSize(void)const " (__imp_?getSize@Window@sf@@QBE?AV?$Vector2@I@2@XZ) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall sf::Window::setActive(bool)const " (__imp_?setActive@Window@sf@@QBE_N_N@Z) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::display(void)" (__imp_?display@Window@sf@@QAEXXZ) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol __imp__glClear@4 referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol __imp__glClearColor@16 referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol __imp__glClearDepth@8 referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol __imp__glColorPointer@16 referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol __imp__glDepthMask@4 referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol __imp__glDisable@4 referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol __imp__glDisableClientState@4 referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol __imp__glDrawArrays@12 referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol __imp__glEnable@4 referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol __imp__glEnableClientState@4 referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol __imp__glFrustum@48 referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol __imp__glLoadIdentity@0 referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol __imp__glMatrixMode@4 referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol __imp__glRotatef@16 referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol __imp__glTranslatef@12 referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol __imp__glVertexPointer@16 referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol __imp__glViewport@16 referenced in function _main
1>c:\users\xxx\documents\visual studio 2012\Projects\Default\Debug\Default.exe : fatal error LNK1120: 31 unresolved externals
 

As I said above, I followed the tutorial exactly, with linking to the correct folders for both Includes and Libraries, and it doesn't work.

I also tried just using the VisualC++11 (32 bit) download straight from the SFML page in case I didn't configure cmake properly, and I'm getting the exact same errors.

Secondly, and slightly less important, the tutorial I linked to above has you create a convenience header:
//sfml.h
#pragma once
#ifndef SFMLFULL_INCLUDED
#define SFMLFULL_INCLUDED
 
#define SFML_STATIC
 
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Network.hpp>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
 
#if defined(_DEBUG) || defined(DEBUG)
    #pragma comment(lib,"sfml-graphics-s-d.lib")
    #pragma comment(lib,"sfml-audio-s-d.lib")
    #pragma comment(lib,"sfml-network-s-d.lib")
    #pragma comment(lib,"sfml-window-s-d.lib")
    #pragma comment(lib,"sfml-system-s-d.lib")
    #pragma comment(lib,"sfml-main-d.lib")
#else
    #pragma comment(lib,"sfml-graphics-s.lib")
    #pragma comment(lib,"sfml-audio-s.lib")
    #pragma comment(lib,"sfml-network-s.lib")
    #pragma comment(lib,"sfml-window-s.lib")
    #pragma comment(lib,"sfml-system-s.lib")
    #pragma comment(lib,"sfml-main.lib")
#endif
 
 
#endif // SFMLFULL_INCLUDED

When I try and include the convenience header, I get errors like this:
1>c:\users\xxx\documents\visual studio 2012\projects\default\default\source.cpp(24): error C3861: 'glClearDepth': identifier not found
1>c:\users\xxx\documents\visual studio 2012\projects\default\default\source.cpp(25): error C3861: 'glClearColor': identifier not found
1>c:\users\xxx\documents\visual studio 2012\projects\default\default\source.cpp(28): error C2065: 'GL_DEPTH_TEST' : undeclared identifier
1>c:\users\xxx\documents\visual studio 2012\projects\default\default\source.cpp(28): error C3861: 'glEnable': identifier not found
1>c:\users\xxx\documents\visual studio 2012\projects\default\default\source.cpp(29): error C2065: 'GL_TRUE' : undeclared identifier
...
 
As if the compiler doesn't include any of the .h files that sfml.h says to include (but I don't get any errors in sfml.h itself.

So to get the link errors that I'm getting above, I have to use the includes exactly as they are written in the example.

Please help, I have no idea where to start, google searching for these terms turns up pages talking about linking to the correct libraries, but I thought that's what I already did when I told the project to use library directories .../lib/release and .../lib/debug?

Thanks!

(I'm using MS VisualStudio 2012 Update 2 V11.0.60315.01 running in Windows 7 Profession 64 bit)

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Can't get SFML 2.1 to work in Visual Studio 2012
« Reply #1 on: October 21, 2013, 12:07:04 am »
Follow the official tutorial on this site: http://www.sfml-dev.org/tutorials/2.1/

The thread you link to is obviously out of date because it refers to 2.0 snapshots, but 2.1 has been out for several months.  It's probably from back when everyone used the SFML 2.0 RC and 2.0 hadn't formally been released with an official tutorial yet.

TheRabbit

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Can't get SFML 2.1 to work in Visual Studio 2012
« Reply #2 on: October 21, 2013, 12:20:53 am »
Forgot to mention that I followed the official 2.1 tutorial and had the same results, which is why I looked elsewhere for a tutorial. Here's the 81 errors I get when I follow the http://www.sfml-dev.org/tutorials/2.1/start-vc.php tutorial:

1>------ Build started: Project: Default, Configuration: Debug Win32 ------
1>sfml-graphics-s-d.lib(Color.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in Source.obj
1>sfml-graphics-s-d.lib(RenderTarget.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in Source.obj
1>sfml-graphics-s-d.lib(RenderWindow.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in Source.obj
1>sfml-graphics-s-d.lib(Shape.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in Source.obj
1>sfml-graphics-s-d.lib(CircleShape.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in Source.obj
1>sfml-graphics-s-d.lib(RenderStates.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in Source.obj
1>sfml-graphics-s-d.lib(Transform.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in Source.obj
1>sfml-graphics-s-d.lib(View.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in Source.obj
1>sfml-graphics-s-d.lib(Shader.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in Source.obj
1>sfml-graphics-s-d.lib(Texture.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in Source.obj
1>sfml-graphics-s-d.lib(GLCheck.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in Source.obj
1>sfml-graphics-s-d.lib(Image.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in Source.obj
1>sfml-graphics-s-d.lib(Transformable.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in Source.obj
1>sfml-graphics-s-d.lib(VertexArray.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in Source.obj
1>sfml-graphics-s-d.lib(TextureSaver.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in Source.obj
1>sfml-graphics-s-d.lib(ImageLoader.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in Source.obj
1>sfml-system-s-d.lib(String.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in Source.obj
1>sfml-system-s-d.lib(Err.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in Source.obj
1>sfml-window-s-d.lib(VideoMode.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in Source.obj
1>sfml-window-s-d.lib(Window.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in Source.obj
1>sfml-window-s-d.lib(VideoModeImpl.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in Source.obj
1>sfml-window-s-d.lib(GlContext.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in Source.obj
1>sfml-window-s-d.lib(WindowImpl.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in Source.obj
1>sfml-window-s-d.lib(WglContext.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in Source.obj
1>sfml-window-s-d.lib(JoystickManager.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in Source.obj
1>sfml-window-s-d.lib(WindowImplWin32.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in Source.obj
1>sfml-window-s-d.lib(JoystickImpl.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in Source.obj
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "void __cdecl std::_Debug_message(wchar_t const *,wchar_t const *,unsigned int)" (?_Debug_message@std@@YAXPB_W0I@Z) already defined in libcpmtd.lib(stdthrow.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: __thiscall std::_Container_base12::_Container_base12(void)" (??0_Container_base12@std@@QAE@XZ) already defined in Source.obj
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: __thiscall std::_Container_base12::~_Container_base12(void)" (??1_Container_base12@std@@QAE@XZ) already defined in Source.obj
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: void __thiscall std::_Container_base12::_Orphan_all(void)" (?_Orphan_all@_Container_base12@std@@QAEXXZ) already defined in Source.obj
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "void __cdecl std::_Xbad_alloc(void)" (?_Xbad_alloc@std@@YAXXZ) already defined in libcpmtd.lib(xthrow.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "void __cdecl std::_Xlength_error(char const *)" (?_Xlength_error@std@@YAXPBD@Z) already defined in libcpmtd.lib(xthrow.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "void __cdecl std::_Xout_of_range(char const *)" (?_Xout_of_range@std@@YAXPBD@Z) already defined in libcpmtd.lib(xthrow.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: __thiscall std::locale::id::id(unsigned int)" (??0id@locale@std@@QAE@I@Z) already defined in Source.obj
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "char const * __cdecl std::_Syserror_map(int)" (?_Syserror_map@std@@YAPBDH@Z) already defined in libcpmtd.lib(syserror.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "char const * __cdecl std::_Winerror_map(int)" (?_Winerror_map@std@@YAPBDH@Z) already defined in libcpmtd.lib(syserror.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: int __thiscall std::ios_base::flags(void)const " (?flags@ios_base@std@@QBEHXZ) already defined in libcpmtd.lib(locale.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: __int64 __thiscall std::ios_base::width(void)const " (?width@ios_base@std@@QBE_JXZ) already defined in libcpmtd.lib(locale.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: __int64 __thiscall std::ios_base::width(__int64)" (?width@ios_base@std@@QAE_J_J@Z) already defined in libcpmtd.lib(locale.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: int __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::sputc(char)" (?sputc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHD@Z) already defined in libcpmtd.lib(locale.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: void __thiscall std::basic_ios<char,struct std::char_traits<char> >::setstate(int,bool)" (?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXH_N@Z) already defined in libcpmtd.lib(cout.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: __thiscall std::_Lockit::_Lockit(int)" (??0_Lockit@std@@QAE@H@Z) already defined in libcpmtd.lib(xlock.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) already defined in libcpmtd.lib(xlock.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: __thiscall std::locale::id::operator unsigned int(void)" (??Bid@locale@std@@QAEIXZ) already defined in libcpmtd.lib(cout.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "private: static class std::locale::_Locimp * __cdecl std::locale::_Getgloballocale(void)" (?_Getgloballocale@locale@std@@CAPAV_Locimp@12@XZ) already defined in libcpmtd.lib(locale0.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: bool __thiscall std::codecvt_base::always_noconv(void)const " (?always_noconv@codecvt_base@std@@QBE_NXZ) already defined in libcpmtd.lib(cout.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: int __thiscall std::codecvt<char,char,int>::in(int &,char const *,char const *,char const * &,char *,char *,char * &)const " (?in@?$codecvt@DDH@std@@QBEHAAHPBD1AAPBDPAD3AAPAD@Z) already defined in libcpmtd.lib(cout.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: int __thiscall std::codecvt<char,char,int>::out(int &,char const *,char const *,char const * &,char *,char *,char * &)const " (?out@?$codecvt@DDH@std@@QBEHAAHPBD1AAPBDPAD3AAPAD@Z) already defined in libcpmtd.lib(cout.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: int __thiscall std::codecvt<char,char,int>::unshift(int &,char *,char *,char * &)const " (?unshift@?$codecvt@DDH@std@@QBEHAAHPAD1AAPAD@Z) already defined in libcpmtd.lib(cout.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: static unsigned int __cdecl std::codecvt<char,char,int>::_Getcat(class std::locale::facet const * *,class std::locale const *)" (?_Getcat@?$codecvt@DDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z) already defined in libcpmtd.lib(cout.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "protected: __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::basic_streambuf<char,struct std::char_traits<char> >(void)" (??0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAE@XZ) already defined in libcpmtd.lib(cout.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: virtual __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::~basic_streambuf<char,struct std::char_traits<char> >(void)" (??1?$basic_streambuf@DU?$char_traits@D@std@@@std@@UAE@XZ) already defined in libcpmtd.lib(cout.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "protected: char * __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::eback(void)const " (?eback@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ) already defined in libcpmtd.lib(cout.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "protected: char * __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::gptr(void)const " (?gptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ) already defined in libcpmtd.lib(cout.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "protected: char * __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::pptr(void)const " (?pptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ) already defined in libcpmtd.lib(cout.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "protected: char * __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::egptr(void)const " (?egptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ) already defined in libcpmtd.lib(cout.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "protected: void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::setg(char *,char *,char *)" (?setg@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAD00@Z) already defined in libcpmtd.lib(cout.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "protected: char * __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::epptr(void)const " (?epptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ) already defined in libcpmtd.lib(cout.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "protected: char * __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::_Gndec(void)" (?_Gndec@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEPADXZ) already defined in libcpmtd.lib(cout.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "protected: char * __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::_Gninc(void)" (?_Gninc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEPADXZ) already defined in libcpmtd.lib(cout.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "protected: char * __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::_Pninc(void)" (?_Pninc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEPADXZ) already defined in libcpmtd.lib(cout.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "protected: void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::_Init(void)" (?_Init@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXXZ) already defined in libcpmtd.lib(cout.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "protected: void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::_Init(char * *,char * *,int *,char * *,char * *,int *)" (?_Init@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAPAD0PAH001@Z) already defined in libcpmtd.lib(cout.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: virtual __thiscall std::basic_ios<char,struct std::char_traits<char> >::~basic_ios<char,struct std::char_traits<char> >(void)" (??1?$basic_ios@DU?$char_traits@D@std@@@std@@UAE@XZ) already defined in libcpmtd.lib(cout.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "protected: __thiscall std::basic_ios<char,struct std::char_traits<char> >::basic_ios<char,struct std::char_traits<char> >(void)" (??0?$basic_ios@DU?$char_traits@D@std@@@std@@IAE@XZ) already defined in libcpmtd.lib(cout.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "private: static class std::locale::_Locimp * __cdecl std::locale::_Init(bool)" (?_Init@locale@std@@CAPAV_Locimp@12@_N@Z) already defined in libcpmtd.lib(locale0.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: wchar_t __thiscall std::ctype<wchar_t>::widen(char)const " (?widen@?$ctype@_W@std@@QBE_WD@Z) already defined in libcpmtd.lib(wlocale.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: char __thiscall std::ctype<wchar_t>::narrow(wchar_t,char)const " (?narrow@?$ctype@_W@std@@QBED_WD@Z) already defined in libcpmtd.lib(wlocale.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: static unsigned int __cdecl std::ctype<wchar_t>::_Getcat(class std::locale::facet const * *,class std::locale const *)" (?_Getcat@?$ctype@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z) already defined in libcpmtd.lib(wlocale.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "protected: void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::setp(char *,char *)" (?setp@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAD0@Z) already defined in libcpmtd.lib(cout.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: __thiscall std::basic_ostream<char,struct std::char_traits<char> >::basic_ostream<char,struct std::char_traits<char> >(class std::basic_streambuf<char,struct std::char_traits<char> > *,bool)" (??0?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N@Z) already defined in libcpmtd.lib(cout.obj)
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: void __thiscall std::basic_ostream<char,struct std::char_traits<char> >::`vbase destructor'(void)" (??_D?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEXXZ) already defined in libcpmtd.lib(cout.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _memmove already defined in LIBCMTD.lib(memmove.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: __invalid_parameter already defined in LIBCMTD.lib(invarg.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: __CrtDbgReportW already defined in LIBCMTD.lib(dbgrptw.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _free already defined in LIBCMTD.lib(dbgfree.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _memcpy_s already defined in LIBCMTD.lib(memcpy_s.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _fclose already defined in LIBCMTD.lib(fclose.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _fflush already defined in LIBCMTD.lib(fflush.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _fgetc already defined in LIBCMTD.lib(fgetc.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _fgetpos already defined in LIBCMTD.lib(fgetpos.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _fputc already defined in LIBCMTD.lib(fputc.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _fsetpos already defined in LIBCMTD.lib(fsetpos.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: __fseeki64 already defined in LIBCMTD.lib(fseeki64.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _fwrite already defined in LIBCMTD.lib(fwrite.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _setvbuf already defined in LIBCMTD.lib(setvbuf.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _ungetc already defined in LIBCMTD.lib(ungetc.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: __lock_file already defined in LIBCMTD.lib(_file.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: __unlock_file already defined in LIBCMTD.lib(_file.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: "public: __thiscall std::bad_cast::bad_cast(char const *)" (??0bad_cast@std@@QAE@PBD@Z) already defined in LIBCMTD.lib(stdexcpt.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _memchr already defined in LIBCMTD.lib(memchr.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _ldexp already defined in LIBCMTD.lib(ldexp.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _feof already defined in LIBCMTD.lib(feoferr.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _strtol already defined in LIBCMTD.lib(strtol.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _malloc already defined in LIBCMTD.lib(dbgmalloc.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _tolower already defined in LIBCMTD.lib(tolower.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _wcslen already defined in LIBCMTD.lib(wcslen.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: ___iob_func already defined in LIBCMTD.lib(_file.obj)
1>MSVCRTD.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMTD.lib(typinfo.obj)
1>MSVCRTD.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMTD.lib(typinfo.obj)
1>sfml-system-s-d.lib(ThreadLocal.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in Source.obj
1>LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Can't get SFML 2.1 to work in Visual Studio 2012
« Reply #3 on: October 21, 2013, 12:31:46 am »
Those are obviously linker errors of some kind but they don't look anything like the usual newbie mistakes.

Are you very sure you got the right binaries for your compiler and OS?  Have you quadruple-checked that you are not mixing static/dynamic settings or debug/release builds?  Can you show us all the relevant settings?  Can you show screenshots of the include/lib folders so we can be sure the files really are where they should be?

TheRabbit

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Can't get SFML 2.1 to work in Visual Studio 2012
« Reply #4 on: October 21, 2013, 12:38:51 am »
I can sure try:







Let me know if there's any other pictures that might help.

Also, this is kind of weird, but to take these screen shots I started a brand new project, following all the tutorial steps, and now I'm only getting 17 linker errors instead of the 81 that I was getting above. I'm almost positive that I did every step exactly the same too.
« Last Edit: October 21, 2013, 12:43:51 am by TheRabbit »

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Can't get SFML 2.1 to work in Visual Studio 2012
« Reply #5 on: October 21, 2013, 12:50:28 am »
First of all, get rid of the convenience header (if you are still using it). It will become more of an inconvenience later on than it is worth. Set up the project properly once and it will do what you want it to do for a long time. Besides... those pragma directives aren't portable anyway, and I'd keep my finger off something that isn't formally standardized.

After you've done that, you can try following this: http://en.sfml-dev.org/forums/index.php?topic=12552.0
Post the output here and we can have a look.

Oh and since it isn't clear to me from your previous posts, which version of SFML are you using? How did you get it? And did you build it yourself or did it come pre-built?
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

TheRabbit

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Can't get SFML 2.1 to work in Visual Studio 2012
« Reply #6 on: October 21, 2013, 04:12:57 am »
Thanks, here's the verbose output:

Code: [Select]
1>------ Build started: Project: Brand New Project, Configuration: Debug Win32 ------
1>  Microsoft (R) C/C++ Optimizing Compiler Version 17.00.60610.1 for x86
1>  Copyright (C) Microsoft Corporation.  All rights reserved.
1> 
1>  cl /c /I"C:\SFML-2.1-windows-vc11-32bits\SFML-2.1\include" /ZI /nologo- /W3 /WX- /sdl /Od /Oy- /D _MBCS /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"Debug\\" /Fd"Debug\vc110.pdb" /Gd /TP /analyze- /errorReport:prompt Main.cpp
1>cl : Command line warning D9035: option 'nologo-' has been deprecated and will be removed in a future release
1> 
1>  Skipping... (no relevant changes detected)
1>  Main.cpp
1>  Microsoft (R) Incremental Linker Version 11.00.60610.1
1>  Copyright (C) Microsoft Corporation.  All rights reserved.
1> 
1>  "/OUT:c:\users\xxx laptop\documents\visual studio 2012\Projects\Brand New Project\Debug\Brand New Project.exe" /INCREMENTAL "/LIBPATH:C:\SFML-2.1-windows-vc11-32bits\SFML-2.1\lib" "sfml-audio-d.lib" "sfml-graphics-d.lib" "sfml-main-d.lib" "sfml-network-d.lib" "sfml-system-d.lib" "sfml-window-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\xxx laptop\documents\visual studio 2012\Projects\Brand New Project\Debug\Brand New Project.pdb" /TLBID:1 /DYNAMICBASE /NXCOMPAT "/IMPLIB:c:\users\xxx laptop\documents\visual studio 2012\Projects\Brand New Project\Debug\Brand New Project.lib" /MACHINE:X86 Debug\Main.obj
1>Main.obj : error LNK2019: unresolved external symbol __imp__glClear@4 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol __imp__glClearColor@16 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol __imp__glClearDepth@8 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol __imp__glColorPointer@16 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol __imp__glDepthMask@4 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol __imp__glDisable@4 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol __imp__glDisableClientState@4 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol __imp__glDrawArrays@12 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol __imp__glEnable@4 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol __imp__glEnableClientState@4 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol __imp__glFrustum@48 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol __imp__glLoadIdentity@0 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol __imp__glMatrixMode@4 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol __imp__glRotatef@16 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol __imp__glTranslatef@12 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol __imp__glVertexPointer@16 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol __imp__glViewport@16 referenced in function _main
1>c:\users\xxx laptop\documents\visual studio 2012\Projects\Brand New Project\Debug\Brand New Project.exe : fatal error LNK1120: 17 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I'm not using the convenience header, since the project wasn't working at all with it in there. I'm using SFML 2.1 downloaded from here: http://www.sfml-dev.org/download/sfml/2.1/ a few hours ago, version Visual C++ 11 (2012) - 32 bits.

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Can't get SFML 2.1 to work in Visual Studio 2012
« Reply #7 on: October 21, 2013, 09:57:20 am »
Try linking to Opengl32 as well.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

 

anything