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

Author Topic: SFML 2.0 - Freetype library linking in graphics module  (Read 6373 times)

0 Members and 1 Guest are viewing this topic.

EatMyShorts

  • Newbie
  • *
  • Posts: 10
    • View Profile
SFML 2.0 - Freetype library linking in graphics module
« on: September 27, 2010, 08:33:36 pm »
Hello,

I have started using SFML 2.0 in my application. Recently I have added 2 new libraries to it zlib and zziplib to be able to read zip archives. Once I linked them as static libraries I received couple of linker errors

1>LIBCMT.lib(dosmap.obj) : error LNK2005: __errno already defined in MSVCRTD.lib(MSVCR90D.dll)

All my projects are supposed to link Multithreaded Runtime libs from DLL (/MD option in VS2008), but from what I saw in dumpbin.exe reports sfml2-graphics-s-d.lib uses freetype.lib which is compiled with /MT Runtime Library option and this is not good.

Is it going to be changed in near future ?

//EDIT:

I have more problems with my application now. I cannot compile it even if i have recompiled FreeType library.

Can you tell me what version of freetype lib are you using. Maybe I have compiled wrong wersion.

//EDIT 2

I have managed to compile it correctly. I have downloaded lates version of Freetype lib. Compile it it /MD[d] option and recompile SFML 2.0

I think this issue should be fixed in SFML 2.0.[/b]

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
SFML 2.0 - Freetype library linking in graphics module
« Reply #1 on: October 04, 2010, 01:19:16 pm »
I'll check this ASAP, thanks for your feedback.
Laurent Gomila - SFML developer

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
SFML 2.0 - Freetype library linking in graphics module
« Reply #2 on: October 15, 2010, 09:34:10 pm »
Done finally :)
Laurent Gomila - SFML developer

EatMyShorts

  • Newbie
  • *
  • Posts: 10
    • View Profile
SFML 2.0 - Freetype library linking in graphics module
« Reply #3 on: November 02, 2010, 10:05:42 pm »
Sorry for my late reply. I have checked new version of SFML 2 and it works perfect only in Release version in Debug build it crashes. Last time I did some research about this problem and managed to compile whole SFML 2.0 project.

Here's what I had to do in order to link SFML 2.0 with my project in both configurations. (BTW: if you need a project that shows this problem let me know i will try to spare some time to prepare a sample mini project)

1. FreetypeLib  recompilation with /MD adn /MDd option
From what i saw in the latest SVN branch you are using the same freetype.lib for Release and Debug configs. This causes problem in Debug builds. There is a confilct between MSVCRT.LIB and MSVCRTD.LIB (as a result program craches ). I think you will have to include debug libs for FreetypeLib

2. JPEGLib
Here is similar problem to previous one. You have to include debug version of lib

Check this site: http://leptonica.org/vs2008doc/building-zlib-libjpeg-libpng.html. Here you can read about building this library. There is a problem because the library does not have Debug config so you have to add it yourself.

3. GLEW
Similar situation to FreetypeLib problem. You will have to include also Debug libs.

Hope this helps :D

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
SFML 2.0 - Freetype library linking in graphics module
« Reply #4 on: November 02, 2010, 10:13:40 pm »
I've never needed debug builds of C libraries before. It has always worked, so the problem really comes from your application. What exactly do you do?
Laurent Gomila - SFML developer

EatMyShorts

  • Newbie
  • *
  • Posts: 10
    • View Profile
SFML 2.0 - Freetype library linking in graphics module
« Reply #5 on: November 02, 2010, 10:31:16 pm »
Everything worked fine until i linked zlib and zziplib libraries. Before that i had no linker problems, even with LIBCMT conflict.

I think the second problem (MSVCRT and MSVCRTD conflict) is not so important as the first one with LIBCMT at least for now, because it affects only Debug config and I can still run my program by switching from debug zlib and zziplib to release dependencies.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
SFML 2.0 - Freetype library linking in graphics module
« Reply #6 on: November 02, 2010, 11:58:32 pm »
So the problem is that you end up with both debug and release versions of zlib linked to the same executable? Why do you use the debug version of zlib?
Laurent Gomila - SFML developer

EatMyShorts

  • Newbie
  • *
  • Posts: 10
    • View Profile
SFML 2.0 - Freetype library linking in graphics module
« Reply #7 on: November 03, 2010, 10:53:08 am »
No, I ended up with linking both Debug and Release Runtime libs to one exec. It is caused by linking SFML (using release runtime libs) and debug zlib and zziplib (using debug runtime libs).

I am using Debug version of zlib just to be able to debug it. It is useful sometimes, but rarely.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
SFML 2.0 - Freetype library linking in graphics module
« Reply #8 on: November 03, 2010, 11:01:36 am »
You need to debug zlib? Really?

I don't think there's an easy solution here, because if I apply your fix (linking to debug zlib in debug SFML libraries), users linking to release zlib in debug mode will face the same problem again.
Laurent Gomila - SFML developer

EatMyShorts

  • Newbie
  • *
  • Posts: 10
    • View Profile
SFML 2.0 - Freetype library linking in graphics module
« Reply #9 on: November 03, 2010, 02:13:00 pm »
I agree with you. I will reconfigure my project as posted earlier and everything should be fine.

Thanks for fixing previous problem :D