Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon


12. August 2011

 

So, for an upcoming post, I’ve decided to dive back into the world of C++ and let me tell you, I already remember why I hate this world so much.  I am an experienced programmer, well over a dozen years coding professionally and I have into a half dozen roadblocks already.  I just can’t fathom how a new developer navigates this minefield!

 

First off I started with CodeBlocks and SFML 1.6 and ran into a major snag right away.  Simply put, the version of MingW that ships with CodeBlocks is not compatible with the version used to compile SFML.  End result, you either need to download MingW separately from CodeBlocks and install the version that works with SFML, or you need to compile SFML yourself to make compatible binaries.  Either option is pretty much a non-starter for a new developer.

 

So I switched over to Visual Studio 2010 that was already installed on my machine, started a new project and …

bjebejcc

 

Lovely…  It would seem that either Visual Studio 2010 SP1, installing Visual Studio Express for XNA / WinPhone, or just upsetting the gods in general has resulted in my install no longer working.  I download and install Microsoft SQL Server Compact 3.5 and no luck.  Install Microsoft SQL Server Compact 3.5 SP2 for Desktop 32 and 64 bit and finally my intellisense seems to be working again… great fun that was.

 

Anyways, at this point I arrive home and decide to switch to my primary development machine, which fortunately is properly configured, set up all the include and library directories in my project, copy the dll’s over into the debug folder and…

 

error

 

Oh for the love of god!  Guess what happened… the SFML binaries are built for Visual Studio 2008 and simply will not work with Visual Studio 2010.  End result… you’ve got to build them yourself.  This again is a complete non-starter for a new developer.  Heck, it’s a pain in the ass for an experienced developer!

 

So I go ahead and download the Visual Studio 2008 sources, open the sln file and let it convert to 2010 format and run a build.

Error    30    error C1083: Cannot open include file: 'QWidget': No such file or directory    c:\users\mike\downloads\sfml-1.6-sdk-windows-vc2008\sfml-1.6\samples\qt\qsfmlcanvas.hpp    9    1    qt
Error    31    error C1083: Cannot open include file: 'wx/wx.h': No such file or directory    c:\users\mike\downloads\sfml-1.6-sdk-windows-vc2008\sfml-1.6\samples\wxwidgets\wxsfmlcanvas.hpp    9    1    wxwidgets
Error    43    error C1083: Cannot open include file: 'QWidget': No such file or directory    c:\users\mike\downloads\sfml-1.6-sdk-windows-vc2008\sfml-1.6\samples\qt\qsfmlcanvas.hpp    9    1    qt
Error    44    error C1083: Cannot open include file: 'wx/wx.h': No such file or directory    c:\users\mike\downloads\sfml-1.6-sdk-windows-vc2008\sfml-1.6\samples\wxwidgets\wxsfmlcanvas.hpp    9    1    wxwidgets

 

…. ugh.  In the end, not really a big deal, just remove the qt and wxsample projects and everything will be fine (or install qt).  Still another monkey wrench thrown at new developers though.

 

Then just to make things even more enjoyable, when you compile the release dll you get:

 

Error    18    error LNK2019: unresolved external symbol "private: static unsigned int * sf::Font::ourDefaultCharset" (?ourDefaultCharset@Font@sf@@0PAIA) referenced in function _main    C:\Users\Mike\Downloads\SFML-1.6-sdk-windows-vc2008\SFML-1.6\samples\build\vc2008\Pong.obj    pong
Error    19    error LNK1120: 1 unresolved externals    C:\Users\Mike\Downloads\SFML-1.6-sdk-windows-vc2008\SFML-1.6\samples\bin\pong.exe    1    1    pong
Error    21    error LNK2019: unresolved external symbol "private: static unsigned int * sf::Font::ourDefaultCharset" (?ourDefaultCharset@Font@sf@@0PAIA) referenced in function _main    C:\Users\Mike\Downloads\SFML-1.6-sdk-windows-vc2008\SFML-1.6\samples\build\vc2008\PostFX.obj    postfx
Error    22    error LNK1120: 1 unresolved externals    C:\Users\Mike\Downloads\SFML-1.6-sdk-windows-vc2008\SFML-1.6\samples\bin\postfx.exe    1    1    postfx

 

Now this is a simple fix, add the preprocessor directive SFML_DYNAMIC to the postfx and pong projects ( not sure why this isn’t already set… ) but again, for a new developer, another show stopper.

 

This is the kind of stuff that really makes me not miss C++!

 

Oh, and for those new developers out there struggling to get SFML working with Visual Studio 2010, I’ve compiled them for you.  Just download them here (6mb zip) and extract these files to your executable directory.

Programming ,

blog comments powered by Disqus

Month List

Popular Comments