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

Author Topic: Multiple Dependencies  (Read 1171 times)

0 Members and 1 Guest are viewing this topic.

whitebeard86

  • Newbie
  • *
  • Posts: 5
  • Gibbo2D Engine Founder
    • View Profile
    • My Portfolio
    • Email
Multiple Dependencies
« on: July 12, 2014, 12:31:16 pm »
Hello everyone,

I have 2 projects (a game project and a library project). In the library project I have a reference to an external library (static) which I don't want to reference in the game project (I want to make it transparent for the game project). The problem is that when I include a header file (in the game project) of the library project which includes a reference to the 3rd party static library, I get compiling errors because I'm not linking that 3rd party library in the game project.



Is there a way to get over this? Can I include the 3rd party library in my library project seamlessly? I don't have much experience in c++, any help is appreciated.

Btw, I'm using Visual Studio 2013
Everyone is entitled to their own opinion, you shared yours, and I shared mine.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Multiple Dependencies
« Reply #1 on: July 12, 2014, 01:40:12 pm »
Avoid including the 3rd party library headers in your own library public headers, and it should be ok.

If your classes have members from the 3rd party library, use (smart) pointers instead and forward declare the classes instead of including their headers.
Laurent Gomila - SFML developer

whitebeard86

  • Newbie
  • *
  • Posts: 5
  • Gibbo2D Engine Founder
    • View Profile
    • My Portfolio
    • Email
Re: Multiple Dependencies
« Reply #2 on: July 12, 2014, 02:28:22 pm »
Thanks Laurent!

The problem was with the public headers, I just included a private header for the 3rd party libraries and it worked
Everyone is entitled to their own opinion, you shared yours, and I shared mine.

 

anything