Question

I was wondering if anyone knew how to link a .so dynamic library (or a .a static library for that mater) in Microsoft visual studio. The following steps have not worked for either .a or .so.

I'm playing around with the vs-android plugging to develop in Android NDK using MVS and I'm trying to add a custom library, compiled as a .so, to the project.

1 - I've created a dynamic library (.so) project alongside one of the sample projects (the san-angeles project), in the same solution.

2 - I've set the .so project, let's call it "engine" as a dependency of san-angeles. The engine.so file is generated without any problems, and appears in the {SolutionFolder?}/Android/Debug folder.

3 - I've added engine.so to the linker additional includes of san-angeles and the {SolutionFolder?}/Android/Debug folder (as a full path, something like C:/projects/.../Debug) to the additional linker directories.

But when I compile san-angeles I get the error:

"arm-linux-androideabi-g++.exe: engine.so: No such file or directory"

So I'm guessing I need to do something else to add a .so/.a to a project? Maybe change the name to libengine.so or something like that? A lot of the default includes have the lib prefix, so I don't know if it's something along those lines.

Thank you for the help, Jaime

Était-ce utile?

La solution

Ok, so in my case this was solved by:

1 - Naming the generated engine.a as libengine.a

2 - Instead of, from MVS, adding engine.a to Preferences/Linker/Additional Dependencies, I added to Preferences/Linker/Command Line -l"engine"

With this, the project finally managed to find and engine.a

Hope this helps someone else. :)

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top