Link to 3rd Party Libraries
I can write any type of source that I want (C++ language) and have Visual Studio include a third party header file (.h) and call a function defined in that header file by linking to the library properly in Visual Studio. This is all using the normal right clicking properties, adding the library and include directories, and #pragma comment(lib, ) in my .cpp / .h files. This works all fine and dandy, which I'm glad it does.
What doesn't work:
The project is supposed to be deployed on the Android OS. (Mobile device). When I hit the export button, I'm getting a linker error when calling the function mentioned above (any function defined in my included third party library).
There are possibly a few things happening - - A second compiler is running during export(clang++.exe from the ndk) that doesn't know what / where the static libraries are (even with the #pragma comment(lib, ) in directly in the source. - I'm using the incorrect library types. I know Android uses .so (Unix) libraries, should I be linking with those instead? Or continue to use .dll (Windows)
I've read through the (convoluted) third party library tutorial, but that's not making very much sense to me. I've also searched for documentation on the ".Build.cs" files which was to no success. Which functions should I be calling in the ".Build.cs" file to say (in english):
"This is exactly where you will find your library Mr. Linker, oh and by the way, this is going onto the Android OS, so this is a .so file for you."
That's all I want to do. :) Simple no wierd spaghetti code trying to link here, there and everywhere. Just one function call that's implemented in a .so file for Android. :) I'm trying to call the function but it can't hear me! How do I tell the linker where my .so file is? Thanks in advance.
I had quite an headhacke myself too following that tutorial, but got it work:
1- compiled the library as static for the needed source (in my case, PocketSphinx for win64 and OsX) 2- created his directories: -MyProject | - ThirdParty | - PocketSphinx | - include - lib | - Mac - x64
In x64 there are the 2 .lib files (windows static library), in Mac the two corresponding .a files (they are 2 in my case, they may be only 1 or more)
3- Edited the Build.cs this way:
Hope this helps ;)
does anybody have any success ?
answered May 05 '17 at 07:58 AM
Have you tried following this tutorial : https://wiki.unrealengine.com/Linking_Static_Libraries_Using_The_Build_System
I haven't deployed to Android myself. But just right clicking projects and setting dependencies there is not usually a good approach because every time you generate new project files all that information is lost. I would highly recommend following the tutorial above. I used it to link some libraries for my project and it works like a charm. I suspect your android woes can be dealt with a similar approach.
answered Jul 30 '14 at 07:23 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here