Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

make error in linux #14

Open
QiYueFeiXue opened this issue Sep 29, 2017 · 2 comments
Open

make error in linux #14

QiYueFeiXue opened this issue Sep 29, 2017 · 2 comments

Comments

@QiYueFeiXue
Copy link

hello, I followed your comand line, but find this error:
JniHelpers/src/test/cpp/NativeObjectTest.cpp:49:24: error: ‘TEST_INTEGER’ was not declared in this scope

@dongjinleekr
Copy link

I also experienced the same problem. For the other people who encountered this problem, here is the solution: Just re-generate test constants definition file with following commands:

src/test/bin/generate_test_constants.sh src/test/data/TestConstants.txt src/test/cpp/TestConstants.h src/test/java/com/spotify/jni/TestConstants.java

This command generates TestConstants.h and TestConstants.java which defines TEST_INTEGER etc from TestConstants.txt. Originally, they are not included in the source tree so you need to generate them. It sometimes generated improperly (I don't know why) so you need to regenerate them.

After giving above commands, You can now build the project without any problem.

@nanmi
Copy link

nanmi commented Dec 11, 2020

It sometimes generated improperly, if you build failed, you should add manually like: #define TEST_STRING "hello, is it me you're looking for?" #define TEST_NULL_CHAR "\0" #define TEST_STRING_WITH_NULL_CHAR "hello \0 world" #define TEST_UTF16_STRING u"UTF16 hello: \u2018." #define TEST_UTF8_STRING u8"a \u0915\u093E\u091A\u0902 \u00F6 1 2 3" #define TEST_INTEGER 42 #define TEST_SHORT 777 #define TEST_BOOLEAN true #define TEST_FLOAT 3.14159f #define TEST_FLOAT_TOLERANCE 0.01 #define TEST_DOUBLE 2.71828 #define TEST_BYTE 72 // #define TEST_CHAR 'ö' JAVA #define TEST_CHAR 'a'
public class TestConstants { public static final String TEST_STRING = "hello, is it me you're looking for?"; public static final String TEST_NULL_CHAR = "\0"; public static final String TEST_STRING_WITH_NULL_CHAR = "hello \0 world"; public static final String TEST_UTF16_STRING = "UTF16 hello: \u2018."; public static final String TEST_UTF8_STRING = "a \u0915\u093E\u091A\u0902 \u00F6 1 2 3"; public static final int TEST_INTEGER = 42; public static final short TEST_SHORT = 777; public static final boolean TEST_BOOLEAN = true; public static final float TEST_FLOAT = 3.14159f; public static final double TEST_FLOAT_TOLERANCE = 0.01; public static final double TEST_DOUBLE = 2.71828; public static final byte TEST_BYTE = 72; public static final char TEST_CHAR = 'a'; // public static final char TEST_CHAR L'ö' CPP } in src/test/cpp/TestConstants.h and src/test/java/com/spotify/jni/TestConstants.java

also, you should add JNI_INCLUDE_DIRS JNI_LIBRARIES environment variable

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants