How to Load .h Files From an External .lib?

RedVonix
Fri, 25 Mar 2016 06:35:43 +0000
Community & Industry Discussion

I have added a library to our project (specifically the Thrift library). Everything appears to be good, however when compiling, the compiler can never find the header files in the libthrift.lib library.

To load the library, I have added the following in our build.cs file:

string LibrariesPath = Path.Combine(ThirdPartyPath, "Thrift", "Libraries");
PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "libthrift.lib"));
PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "Thrift", "Includes"));

The libthrift.lib file itself is placed in ThirdParty/Thrift/Libraries/libthrift.lib

Now when we want to access the library, we include the header file (Thrift.h) which is present in the .lib, by doing this:

#include <Thrift/Thrift.h>

And that is where things fall apart. Anytime we try and load the header files in the lib, we just get errors, as such:

Severity Code Description File Project Line Suppression State
Error (active) cannot open source file “Thrift/Thrift.h” d:\Projects\thegrid\Source\TheGrid\thrift_grid_types.h TheGrid 12
Error (active) cannot open source file “Thrift/TApplicationException.h” d:\Projects\thegrid\Source\TheGrid\thrift_grid_types.h TheGrid 13
Error (active) cannot open source file “Thrift/protocol/TProtocol.h” d:\Projects\thegrid\Source\TheGrid\thrift_grid_types.h TheGrid 14
Error (active) cannot open source file “Thrift/transport/TTransport.h” d:\Projects\thegrid\Source\TheGrid\thrift_grid_types.h TheGrid 15
Error (active) cannot open source file “Thrift/cxxfunctional.h” d:\Projects\thegrid\Source\TheGrid\thrift_grid_types.h TheGrid 17

I’ve read so many tutorials and pieces of documentation on adding libraries to UE4 that I’m getting dizzy, and coming up with no solutions to this. Any pointers or thoughts or direction would be greatly appreciated - thank you!

1 post - 1 participant