1

Can't build Android C++ projects with OpenCV (static library) on Visual Studio clang.exe. Here's the build output.

1>------ Build started: Project: AndroidTry.NativeActivity, Configuration: Debug x86 ------
1>ANDROID_HOME=C:\ProgramData\Microsoft\AndroidSDK\25
1>ANT_HOME=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Apps\apache-ant-1.9.3
1>JAVA_HOME=C:\Program Files\Android\jdk\microsoft_dist_openjdk_1.8.0.25
1>NDK_ROOT=C:\\Microsoft\AndroidNDK64\android-ndk-r15c
1> undefined reference to 'show_picture()'
1>clang.exe: error: linker command failed with exit code 1
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Application 
Type\Android\3.0\Android.Common.targets(104,5): error MSB6006: "clang.exe" exited with code 1.
1>Done building project "AndroidTry.NativeActivity.vcxproj" -- FAILED. 
MaanooAk
  • 2,418
  • 17
  • 28
  • The line `undefined reference to 'show_picture()'` is what you want. The `show_picture` function that you call is not defined. For more post a sample of your code. – MaanooAk Feb 29 '20 at 13:14
  • this function is defined in static lib and simply shows a picture.. void show_picture() { Mat m = imread("C:\\Users\\User\\source\\repos\\MFCApplication3\\StaticLib1\\coy.jpg"); namedWindow("Window", WINDOW_FREERATIO); imshow("Window", m); waitKey(0); } – Areg Abgaryan Feb 29 '20 at 13:17
  • 1
    you'll have to link the livrary correctly and the library must be built compatible to your compiler – Micka Feb 29 '20 at 13:21
  • Micka, are you about the x64 or x86? – Areg Abgaryan Feb 29 '20 at 13:27

0 Answers0