Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Invalid arguments for standard function calls

I want to reuse my native c++ files in a android project. When I paste the files into the jni folder the compiler gives me invalid argument errors for functions like substr or fwrite.

The example:

#include <string>
#include <vector>
using namespace std;
using namespace cv;
...
std::string str="We think in generalities, but we live in details.";   
std::string str2 = str.substr (12,12);   // "generalities"

does the compiler quit with:

Invalid arguments ' Candidates are: std::basic_string<char,std::char_traits<char>,std::allocator<char>> 
 substr(?, ?) '

I obviously missed something general! I'm using OpenCV 2.4.3.2 for Android and C/C++ Dev. Tools 8.1.1 for Eclipse.

click to hide/show revision 2
Android.mk and Application.mk added

Invalid arguments for standard function calls

I want to reuse my native c++ files in a android project. When I paste the files into the jni folder the compiler gives me invalid argument errors for functions like substr or fwrite.

The example:

#include <string>
#include <vector>
using namespace std;
using namespace cv;
...
std::string str="We think in generalities, but we live in details.";   
std::string str2 = str.substr (12,12);   // "generalities"

does the compiler quit with:

Invalid arguments ' Candidates are: std::basic_string<char,std::char_traits<char>,std::allocator<char>> 
 substr(?, ?) '

I obviously missed something general! I'm using OpenCV 2.4.3.2 for Android and C/C++ Dev. Tools 8.1.1 for Eclipse.

My Application.mk:

APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_ABI := armeabi-v7a
APP_PLATFORM := android-8

Android.mk:

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
include ../../sdk/native/jni/OpenCV.mk
LOCAL_MODULE    := native_sample
LOCAL_SRC_FILES := jni_part.cpp
LOCAL_LDLIBS +=  -llog -ldl
include $(BUILD_SHARED_LIBRARY)

Invalid arguments for standard function calls

I want to reuse my native c++ files in a android project. When I paste the files into the jni folder the compiler gives me invalid argument errors for functions like substr or fwrite.

The example:

#include <string>
#include <vector>
using namespace std;
using namespace cv;
...
std::string str="We think in generalities, but we live in details.";   
std::string str2 = str.substr (12,12);   // "generalities"

does the compiler quit with:

Invalid arguments ' Candidates are: std::basic_string<char,std::char_traits<char>,std::allocator<char>> 
 substr(?, ?) '

I obviously missed something general! I'm using OpenCV 2.4.3.2 for Android and C/C++ Dev. Tools 8.1.1 8.0 for Eclipse.

My Application.mk:

APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_ABI := armeabi-v7a
APP_PLATFORM := android-8

Android.mk:

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
include ../../sdk/native/jni/OpenCV.mk
LOCAL_MODULE    := native_sample
LOCAL_SRC_FILES := jni_part.cpp
LOCAL_LDLIBS +=  -llog -ldl
include $(BUILD_SHARED_LIBRARY)
click to hide/show revision 4
additional information, screenshot, detail

Invalid arguments for standard function calls

*Update: I need to mention that this error only occurs when I open the cpp file. When I close the file and close and open the project, the errors disappear (till I open the file again)*


I want to reuse my native c++ files in a android project. When I paste the files into the jni folder the compiler gives me invalid argument errors for functions like substr or fwrite.

The example:

#include <string>
#include <vector>
using namespace std;
using namespace cv;
cv;![image description](/upfiles/13650007544757126.png)
...
std::string str="We think in generalities, but we live in details.";   
std::string str2 = str.substr (12,12);   // "generalities"

does the compiler quit with:

Invalid arguments ' Candidates are: std::basic_string<char,std::char_traits<char>,std::allocator<char>> 
 substr(?, ?) '

I obviously missed something general! I'm using OpenCV 2.4.3.2 for Android and C/C++ Dev. Tools 8.0 for Eclipse.

My Application.mk:

APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_ABI := armeabi-v7a
APP_PLATFORM := android-8

Android.mk:

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
include ../../sdk/native/jni/OpenCV.mk
LOCAL_MODULE    := native_sample
LOCAL_SRC_FILES := jni_part.cpp
LOCAL_LDLIBS +=  -llog -ldl
include $(BUILD_SHARED_LIBRARY)

Invalid arguments for standard function calls

*Update: I need to mention that this error only occurs when I open the cpp file. When I close the file and close and open the project, the errors disappear (till I open the file again)*


I want to reuse my native c++ files in a android project. When I paste the files into the jni folder the compiler gives me invalid argument errors for functions like substr or fwrite.

The example:

#include <string>
#include <vector>
using namespace std;
using namespace cv;![image description](/upfiles/13650007544757126.png)
...
std::string str="We think in generalities, but we live in details.";   
std::string str2 = str.substr (12,12);   // "generalities"

does the compiler quit with:

Invalid arguments ' Candidates are: std::basic_string<char,std::char_traits<char>,std::allocator<char>> 
 substr(?, ?) '

I obviously missed something general! I'm using OpenCV 2.4.3.2 for Android and C/C++ Dev. Tools 8.0 for Eclipse.

My Application.mk:

APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_ABI := armeabi-v7a
APP_PLATFORM := android-8

Android.mk:

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
include ../../sdk/native/jni/OpenCV.mk
LOCAL_MODULE    := native_sample
LOCAL_SRC_FILES := jni_part.cpp
LOCAL_LDLIBS +=  -llog -ldl
include $(BUILD_SHARED_LIBRARY)

image description

Invalid arguments for standard function calls

*Update: I need to mention that this error only occurs when I open the cpp file. When I close the file and close and open the project, the errors disappear (till I open the file again)*


I want to reuse my native c++ files in a android project. When I paste the files into the jni folder the compiler gives me invalid argument errors for functions like substr or fwrite.

The example:

#include <string>
#include <vector>
using namespace std;
using namespace cv;![image description](/upfiles/13650007544757126.png)
...
std::string str="We think in generalities, but we live in details.";   
std::string str2 = str.substr (12,12);   // "generalities"

does the compiler quit with:


Invalid arguments ' Candidates are: std::basic_string<char,std::char_traits<char>,std::allocator<char>> 
 substr(?, ?) '

I obviously missed something general! I'm using OpenCV 2.4.3.2 for Android and C/C++ Dev. Tools 8.0 for Eclipse.

My Application.mk:

APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_ABI := armeabi-v7a
APP_PLATFORM := android-8

Android.mk:

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
include ../../sdk/native/jni/OpenCV.mk
LOCAL_MODULE    := native_sample
LOCAL_SRC_FILES := jni_part.cpp
LOCAL_LDLIBS +=  -llog -ldl
include $(BUILD_SHARED_LIBRARY)

image description

click to hide/show revision 7
No.7 Revision

Invalid arguments for standard function calls

*Update: I need to mention that this error only occurs when I open the cpp file. When I close the file and close and open the project, the errors disappear (till I open the file again)*


I want to reuse my native c++ files in a android project. When I paste the files into the jni folder the compiler gives me invalid argument errors for functions like substr or fwrite.

The example:

#include <string>
#include <vector>
using namespace std;
using namespace cv;![image description](/upfiles/13650007544757126.png)
cv;
...
std::string str="We think in generalities, but we live in details.";   
std::string str2 = str.substr (12,12);   // "generalities"

image description does the compiler quit with:


Invalid arguments ' Candidates are: std::basic_string<char,std::char_traits<char>,std::allocator<char>> 
 substr(?, ?) '

I obviously missed something general! I'm using OpenCV 2.4.3.2 for Android and C/C++ Dev. Tools 8.0 for Eclipse.

My Application.mk:

APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_ABI := armeabi-v7a
APP_PLATFORM := android-8

Android.mk:

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
include ../../sdk/native/jni/OpenCV.mk
LOCAL_MODULE    := native_sample
LOCAL_SRC_FILES := jni_part.cpp
LOCAL_LDLIBS +=  -llog -ldl
include $(BUILD_SHARED_LIBRARY)

image description