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

Author Topic: Need help for compiling on Visual Studio 14 CTP  (Read 5594 times)

0 Members and 1 Guest are viewing this topic.

sharethis

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
Need help for compiling on Visual Studio 14 CTP
« on: September 09, 2014, 12:19:10 am »
Hi guys,

I'm trying to use SFML with the newest Visual Studio version, 14 CTP. In order to compile it, I downloaded the newest snapshot from Github and generated project files for Visual Studio 13, which got upgraded on opening. After building the static SFML libraries, I combined them into one library using lib.exe.

The problem is that I get 4 linker errors when I try to compile a simple test program that only creates a sf::RenderWindow.

sfml.lib(jerror.obj) : error LNK2019: unresolved external symbol _fprintf referenced in function _output_message
sfml.lib(jerror.obj) : error LNK2019: unresolved external symbol ___iob_func referenced in function _output_message
sfml.lib(jerror.obj) : error LNK2019: unresolved external symbol _sprintf referenced in function _format_message
sfml.lib(jmemmgr.obj) : error LNK2019: unresolved external symbol _sscanf referenced in function _jinit_memory_mgr

I think the issue is about libjpeg. How can I debug this problem?
« Last Edit: September 09, 2014, 12:21:01 am by sharethis »

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Need help for compiling on Visual Studio 14 CTP
« Reply #1 on: September 09, 2014, 01:06:24 am »
I'm trying to use SFML with the newest Visual Studio version, 14 CTP.
Why?
SFML barely has out-of-the-box support for Visual Studio 2013 yet, and the P in CTP stands for preview, meaning that it isn't final and things might still be broken.
and generated project files for Visual Studio 13
Why?
If you are serious about testing out Visual Studio 14, then at least get a CMake nightly build as well. They already have "support" for Visual Studio 14.
I combined them into one library using lib.exe.
Why?
Just... don't... do this.

I think the issue is about libjpeg. How can I debug this problem?
You can't debug something that isn't a bug ::). The distribution of SFML and its accompanying source on GitHub was not made or tested for Visual Studio 14. It will probably come at some point, but not yet. Laurent has this habit of committing pre-built library blobs of external libraries into the git repository as well. Obviously if they are built with Visual Studio 2012 in mind, and just happen to function with Visual Studio 2013 by luck, they aren't guaranteed to work automatically with Visual Studio 14. You will have to rebuild all the external libraries yourself since it is likely Microsoft decided to change something in the library interface that made the pre-built libraries unusable.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

sharethis

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
Re: Need help for compiling on Visual Studio 14 CTP
« Reply #2 on: September 09, 2014, 07:42:34 pm »
I switched over to Visual Studio 14 CTP because it adds support for std::integer_sequence which I want to use. As far as my experience goes, the CTP releases are already stable enough for a free time project. Is there a practical reason against combining the libs of one framework like SFML?

Thanks for pointing that CMake nightly already has support for VS14. This time, I also checked the option to add SFML examples to directly test if it works. Four of the examples failed to build because of linker errors for freetype.lib and jpeg.lib. Therefore, I downloaded the sources of the newest versions of both libraries and compiled them using VS14 in release mode with /MT. After copying those two libs to SFML\extlibs\libs-msvc\x86, only the opengl, pong and shader examples still fail to build. I already build newest GLEW because the failing examples are all OpenGL related, but it didn't help.

This is the part of the build log that shows the linker error. They're pretty similar to this problem description.

freetype.lib(ftbase.obj) : error LNK2001: unresolved external symbol __imp__strncpy
freetype.lib(truetype.obj) : error LNK2001: unresolved external symbol __imp__strstr
MSVCRT.lib(chandler4gs.obj) : error LNK2001: unresolved external symbol __except_handler4_common
C:\SFML\examples\pong\Release\pong.exe : fatal error LNK1120: 3 unresolved externals
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
freetype.lib(ftbase.obj) : error LNK2001: unresolved external symbol __imp__strncpy
freetype.lib(truetype.obj) : error LNK2001: unresolved external symbol __imp__strstr
MSVCRT.lib(chandler4gs.obj) : error LNK2001: unresolved external symbol __except_handler4_common
C:\SFML\examples\shader\Release\shader.exe : fatal error LNK1120: 3 unresolved externals
  jpeg.lib(jerror.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
  jpeg.lib(jerror.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
  Generating code
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
freetype.lib(ftbase.obj) : error LNK2001: unresolved external symbol __imp__strncpy
freetype.lib(truetype.obj) : error LNK2001: unresolved external symbol __imp__strstr
MSVCRT.lib(chandler4gs.obj) : error LNK2001: unresolved external symbol __except_handler4_common
C:\SFML\examples\opengl\Release\opengl.exe : fatal error LNK1120: 3 unresolved externals

capz

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: Need help for compiling on Visual Studio 14 CTP
« Reply #3 on: November 25, 2014, 02:49:17 pm »
I don't suppose you'd mind sharing your VS14 build+deps of SFML? I have (almost) no experience with C++ on windows, only done C# with it. Trying to get my code to build but it uses too many C++11 features that are unsupported by VS13.. (main platform is Mac OS X+Clang++)