Ошибка компиляции cimg lib для Android

Я пытаюсь скомпилировать CImg для Android. Но получил такие ошибки при компиляции.

это часть Application.mk `

APP_STL := gnustl_static 
NDK_TOOLCHAIN_VERSION=4.9 
APP_CPPFLAGS +=-std=c++11
APP_ABI := armeabi armeabi-v7a 
APP_CPPFLAGS += -frtti
APP_CPPFLAGS += -fexceptions
APP_CPPFLAGS += -DANDROID

APP_OPTIM := release
LOCAL_ARM_MODE := thumb 

Я получил следующие ошибки

/CImg.h: In member function 'cimg_library::CImg<typename cimg_library::cimg::last<T, int>::type>
 cimg_library::CImg<T>::_get_select(cimg_library::CImgDisplay&, const char*, unsigned int, unsigned int*, int, int, int, bool, bool) const':
./CImg.h:38224:15: error: expected unqualified-id before numeric constant
           _X = (int)X, _Y = (int)Y, _Z = (int)Z,
           ^
In file included /test.cpp:2069:
./CImg.h:38249:32: error: 'yf' was not declared in this scope
           visu.draw_line(0,yf,visu.width() - 1,yf,foreground_color,0.7f,0xFF00FF00).
./CImg.h:38251:27: error: 'xf' was not declared in this scope
             draw_line(xf,0,xf,visu.height() - 1,foreground_color,0.7f,0xFF00FF00).
./CImg.h:38254:32: error: 'zxf' was not declared in this scope
             visu.draw_line(zxf,0,zxf,yM,foreground_color,0.7f,0xFF00FF00).
                            ^
./CImg.h:38254:42: error: 'yM' was not declared in this scope
             visu.draw_line(zxf,0,zxf,yM,foreground_color,0.7f,0xFF00FF00).
                                      ^
./CImg.h:38256:31: error: 'zyf' was not declared in this scope
               draw_line(0,zyf,xM,zyf,foreground_color,0.7f,0xFF00FF00).
                           ^
./CImg.h:38256:35: error: 'xM' was not declared in this scope
               draw_line(0,zyf,xM,zyf,foreground_color,0.7f,0xFF00FF00).

Почему? Как это исправить?


person songtzu    schedule 11.08.2015    source источник


Ответы (1)


молодец, сам решил. Эта проблема вызвана компилятором, в котором одна строка кода не может определить слишком много переменных (версия ndk - r9d).

int a = 1, b = 2, c = 3, d =4, e = 5;

превратить этот код в многострочный.

int a = 1;
int b = 2;
int c = 3;
int d = 4;
int e = 5;

это решило мой вопрос.

person songtzu    schedule 14.08.2015