Reputation: 21
scenario: CCPJNI.java makes JNI call to CPPJNI.cpp which I build include in libCCBJNI.so cpp code is executed correctly until it reaches stringstream declaration then error: java: symbol lookup error: .../libCCBJNI.so: undefined symbol: _ZNSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEEC1Ev
CCBJNI.cpp
.
.
out << "write 0 \r\n";
std::ostringstream ss;
cout << "write 1 \r\n";
.
.
Java compiles: javac -cp ccb.jar:/usr/lib/gcc/x86_64-linux-gnu/7/libgcc._s.so.1:libCCBJNI.so:json-simple-1.1.1.jar:azure-storage-4.2.0.jar CCBTEST.java
javac -cp ccb.jar:LIBCCBJNI.so:json-simple-1.1.1.jar:azure-storage-4.2.0.jar com/shiseido/ccb/CCBJNI.java
Java run: java -cp .:/usr/lib/gcc/x86_64-linux-gnu/7/libgcc._s.so.1:ccb.jar:libCCBJNI.so:jackson-core-2.12.0-rc1.jar:json-simple-1.1.1.jar:azure-storage-4.2.0.jar CCBTEST
output: . . write 0 java: symbol lookup error: /mnt/c/Users/robsc/pahub-linux/pahub_scantech_platform_jniCopy7/Platform_JNI/CCBJNI/gdb2/CCBJNI/Remix/Source/libCCBJNI.so: undefined symbol: _ZNSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEEC1Ev
note: there is much more preceding code and preceding output that confirms the cpp code and standard libRARY are working fine other than the stringstream.
I am building libCCBJNI.so with visual Studio 2019 running on Windows and building for Linux
question: How do I fix this? Is stringstream in a separate cpp shared library? If so what is the lib name, where can I it? How do I include it in my build and runtime?
Upvotes: 0
Views: 466
Reputation: 21
Appears it was an environment issue. After re-installing Ubuntu on Windows WSL and issue: sudo apt update sudo apt install build-essential it works with no unresolved symbols
Upvotes: 0