Sergey  Artyuh
Sergey Artyuh

Reputation: 53

Visual Studio 15 Android "error: undefined reference to"

I've built static libraris ( *.a ), added them to my VS project for android. If I call function from one of library - it works good. But when a function from one static library calls a function from another static library - it causes error : "undefined reference to"

Upvotes: 0

Views: 1060

Answers (1)

Sergey Lebedkin
Sergey Lebedkin

Reputation: 11

Open properties page on the second library project. Move to Linker -> All options. Find "Additional options" property. By default it should be empty for all Platforms and Configurations.

To solve problem with cmath functions, f.e. "error : undefined reference to 'sinf'", add to "Additional options" -lm key

To solve problem with zlib.h functions, f.e. "error : undefined reference to 'zlibVersion'", add to "Additional options" -lz key

I think that there is much more helpful keys

UPDATE: Look on https://developer.android.com/ndk/guides/stable_apis.html. There is a list of additional keys, where LOCAL_LDLIBS is analog of "Additional options" property (I quess)

Upvotes: 1

Related Questions