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

Author Topic: sf::priv and Linker Problems  (Read 2884 times)

0 Members and 1 Guest are viewing this topic.

Vovosunt

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
sf::priv and Linker Problems
« on: December 05, 2013, 04:09:56 pm »
I'm making a 3d engine on top of SFML so I have to basically remake SFML/Graphic in 3D.
This takes for the most part a lot of copy pasting of original SFML code and making some little changes to it.
I've made a RenderTexture3 (3 for 3D  :P) class and everything compiles just right but I get some linker error on the Texture implementations that are in sf::priv namespace:
error LNK2019: unresolved external symbol "public: __thiscall
sf::priv::RenderTextureImplFBO::RenderTextureImplFBO(void)" (??
0RenderTextureImplFBO@priv@sf@@QAE@XZ) referenced in function "public: bool __thiscall
RenderTexture3::create(unsigned int,unsigned int,bool)" (?create@RenderTexture3@@QAE_NII_N@Z)

error LNK2019: unresolved external symbol "public: static bool __cdecl
sf::priv::RenderTextureImplFBO::isAvailable(void)" (?isAvailable@RenderTextureImplFBO@priv@sf@@SA_NXZ)
 referenced in function "public: bool __thiscall RenderTexture3::create(unsigned int,unsigned int,bool)" (?
create@RenderTexture3@@QAE_NII_N@Z)

error LNK2019: unresolved external symbol "public: __thiscall
sf::priv::RenderTextureImplDefault::RenderTextureImplDefault(void)" (??
0RenderTextureImplDefault@priv@sf@@QAE@XZ) referenced in function "public: bool __thiscall
RenderTexture3::create(unsigned int,unsigned int,bool)" (?create@RenderTexture3@@QAE_NII_N@Z)

And the responsible code part (basically the same as in sf::RenderTexture)
        // Create the implementation
        delete impl_;
        if (sf::priv::RenderTextureImplFBO::isAvailable())
        {
                // Use frame-buffer object (FBO)
                impl_ = new sf::priv::RenderTextureImplFBO();
        }
        else
        {
                // Use default implementation
                impl_ = new sf::priv::RenderTextureImplDefault();
        }

        // Initialize the render texture
        if (!impl_->create(width, height, tex_.m_texture, depthBuffer))
                return false;

I've asked Laurent quite long ago about a similar problem with glcheck.
He told me to make a new class for that and I did.
This time I don't want to make a new class, mostly because I will have to recreate a whole group of classes and update them myself later, which goes against my goal of basing my engine on SFML and only updating the relevant parts.

I hope someone here can help me ;)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: sf::priv and Linker Problems
« Reply #1 on: December 05, 2013, 07:21:17 pm »
Classes in sf::priv are private, and thus not exported. You can't access them through the SFML libraries.
Laurent Gomila - SFML developer

Vovosunt

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Re: sf::priv and Linker Problems
« Reply #2 on: December 06, 2013, 05:06:14 pm »
So is there any way to make it work without breaking everything?
I'm really not experienced at working with dlls  :-\

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: sf::priv and Linker Problems
« Reply #3 on: December 06, 2013, 08:46:31 pm »
I've made a RenderTexture3 (3 for 3D  :P) class
Do you work with actual 3D textures (which have 3 dimensions) or should it be capable of projecting 3D scenes onto a texture? Because otherwise, the render texture implementation will probably not differ that much from 2D...

So is there any way to make it work without breaking everything?
You're not supposed to access the sf::priv namespace. So you have to find a way to work with the public API, or modify the SFML source code.

What are the design goals of your 3D library? Should it extend an un-changed SFML or do you plan to modify SFML itself in order to incorporate new functionality? Will you have a separate library or just a modded SFML?
« Last Edit: December 06, 2013, 08:48:31 pm by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Vovosunt

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Re: sf::priv and Linker Problems
« Reply #4 on: December 07, 2013, 02:21:27 pm »
Do you work with actual 3D textures (which have 3 dimensions) or should it be capable of projecting 3D scenes onto a texture? Because otherwise, the render texture implementation will probably not differ that much from 2D...
Projecting 3D scenes onto it. And yes the implementation barely differs from the original. I have a working RenderTarget3 and respectively RenderWindow3 that draws 3d without a problem and RenderTexture3 inherits from RenderTarget3.

What are the design goals of your 3D library? Should it extend an un-changed SFML or do you plan to modify SFML itself in order to incorporate new functionality? Will you have a separate library or just a modded SFML?
Just a generic kind of 3D engine. I don't plan to modify the sound/window/networking parts in hopes of keeping it cross platform, but I've already modified some of the sfml graphics source code and will do so further if needed.

Do I need to modify some source code and recompile the dlls to fix this problem then?  ???

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: sf::priv and Linker Problems
« Reply #5 on: December 07, 2013, 02:58:58 pm »
Just a generic kind of 3D engine.
That doesn't answer my question: Are you modifying SFML itself or building a separate library (I assume the latter)? The whole discussion highly depends on whether you are willing to change the code inside SFML itself or rather re-implement the Graphics part completely in your own engine.

Do I need to modify some source code and recompile the dlls to fix this problem then?  ???
Since you cannot access the SFML implementation details, yes. Maybe it will suffice to export the missing symbols, but a clean solution would include an API that can be used by your library. Or copy the code into your own library and modify it there. Make sure you regard the SFML license.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

 

anything