Thread: Error while trying to build android app. #error Bionic header ctype.h does not define

  1. #1
    Registered User
    Join Date
    Jul 2015
    Posts
    2

    Error while trying to build android app. #error Bionic header ctype.h does not define

    Hi guys,
    I have some very useful app that calculates some water/steam properties (engineering stuff). Now I thought I might just build it for android and run it on my android phone so I don't have to take my laptop with me all the time.

    But it doesn't build. It fails with the error:

    Code:
    ctyp_base.h
    // ISO C++ 14882: 22.1  Locales
    //
    
    // Information as gleaned from /usr/include/ctype.h, for solaris2.5.1
    
    // Support for Solaris 2.5.1
    
    #if defined (__ANDROID__)
    #if !defined(_U)
    #if !defined(_CTYPE_U)
    #error Bionic header ctype.h does not define either _U nor _CTYPE_U
    #endif
    #define _U _CTYPE_U
    #define _L _CTYPE_L
    #define _N _CTYPE_N
    #define _S _CTYPE_S
    #define _P _CTYPE_P
    #define _C _CTYPE_C
    #define _X _CTYPE_X
    #define _B _CTYPE_B
    #endif
    #endif /* __ANDROID__ */
    
    namespace std _GLIBCXX_VISIBILITY(default)
    {
    _GLIBCXX_BEGIN_NAMESPACE_VERSION
    These lines come up just before the aforementioned error (in Qt crator).



    /opt/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include/bits/locale_facets.h:41:
    In file included from
    /opt/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include/bits/locale_facets.h:41:0,



    /opt/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include/bits/basic_ios.h:37:
    from
    /opt/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include/bits/basic_ios.h:37,



    /opt/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include/ios:44:
    from
    /opt/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include/ios:44,



    /opt/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include/ostream:38:
    from
    /opt/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include/ostream:38,



    /opt/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include/iostream:39:
    from
    /opt/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include/iostream:39,



    /home/ihaaaaa/QtProjects/freesteam/main.cpp:8: from ../freesteam/main.cpp:8:




    There also a bunch of other errors after the actual error. All of the type:



    /opt/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include/bits/ctype_base.h:62:
    error: '_CTYPE_U' was not declared in this scope

    static const mask upper = _U;

    ^

    /opt/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include/bits/ctype_base.h:63:
    error: '_CTYPE_L' was not declared in this scope

    static const mask lower = _L;




    I though these may be as a result of the first error.



    I asked on another forum and was told that this is not Qt related and
    that it has something to do with C so that's why I'm posting it here.



    This is my first time in this forum so if this question is in the wrong
    place or somehow violates the rules of this site please remove it or let
    me know and I'll do what I can to fix/remove it.



    Some additional info. I'm using Qt5.4/qtcreator in a Linux Mint x64 machine.

    I know (at least I think) that Qt5.4 is setup correctly because I can
    build/run programs, that do not need additional libraries, on my android
    device.



    And here's the .pro file of my program.

    TEMPLATE = app

    QT += qml quick

    SOURCES += main.cpp \
    mysteamclass.cpp

    RESOURCES += qml.qrc

    # Additional import path used to resolve QML modules in Qt Creator's code model
    QML_IMPORT_PATH =

    # Default rules for deployment.
    include(deployment.pri)

    DISTFILES +=

    HEADERS += \
    mysteamclass.h
    #--------------------------------ME= C++11 AND LIBRARIES-----------------#

    CONFIG+=c++11


    INCLUDEPATH += /usr/local/include
    INCLUDEPATH += /usr/local/freesteam

    DEPENDPATH += /usr/local/include


    LIBS += -L/usr/local/include/

    LIBS += -L/usr/local/include -lgsl

    LIBS += -L/usr/local/include -libfreesteam
    LIBS += -L/usr/local/include -lgslcblas

    LIBS+= -L/usr/lib/freesteam



    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../usr/lib/release/ -lfreesteam
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../usr/lib/debug/ -lfreesteam
    else:unix: LIBS += -L$$PWD/../../../../usr/lib/ -lfreesteam

    INCLUDEPATH += $$PWD/../../../../usr/include
    DEPENDPATH += $$PWD/../../../../usr/include


    Thank you for your time and/or any replies.

  2. #2
    Registered User
    Join Date
    May 2010
    Posts
    4,596
    Also posted here.

    Please post your code, it's more likely that the problem is within your code than it is within the system headers.

    Jim

  3. #3
    Registered User
    Join Date
    Jul 2015
    Posts
    2
    Quote Originally Posted by jimblumberg View Post
    Also posted here.

    Please post your code, it's more likely that the problem is within your code than it is within the system headers.

    Jim
    I'm sorry. Shouldn't I have posted this here to? If that's the case I can remove this post. No intention on breaking the site rules or trolling.

    Well, were could I post the code?

    Since it's about a thousand lines of QML and a couple of hundred lines C++. Or should I just post it here?

    EDIT. Here's my c++ class. Which is used to call some functions from a library called freesteam, which in terms links to the GNU Scientific Library I believe. Maybe the problem is happening some other place than the code I've written. And I should've added that it builds just fine when building for the desktop. This error only occurs when trying to build for android.

    Code:
    #ifndef MYSTEAMCLASS_H
    #define MYSTEAMCLASS_H
    
    extern "C" {
    
    #include <freesteam/steam_ps.h>
    #include <freesteam/steam_pT.h>
    #include <freesteam/region4.h>
    #include <freesteam/steam_ph.h>
    #include <freesteam/steam_pv.h>
    #include <freesteam/steam_Ts.h>
    #include <freesteam/steam_Tx.h>
    
    #include <stdio.h>
    }
    
    #include <QObject>
    #include <QDebug>
    
    class MySteamClass : public QObject
    {
        Q_OBJECT
    public:
        explicit MySteamClass(QObject *parent = 0);
    
    private:
        double pressure=0;
        double temperature=0;
        double specificEntropy=0;
        double specificEnthalpy=0;
        double specificInternalEnergy=0;
        double specificVolume=0;
        double density=0;
        double heatCapacity_Cp=0;
        double heatCapacity_Cv=0;
        double quality=0;
        double thermalConductivity=0;
        double viscosity=0;
    
        SteamState state;
    
    public:
        Q_INVOKABLE void setState_PressureTemperature(double pres, double temp);
        Q_INVOKABLE void setState_PressureSpecificInternalEnergy(double pres, double intEn);
        Q_INVOKABLE void setState_PressureSpecificEntropy(double pres, double entrop);
        Q_INVOKABLE void setState_PressureSpecificEnthalpy(double pres, double enthalp);
        Q_INVOKABLE void setState_PressureSpecificVolume(double pres, double enthalp);
        Q_INVOKABLE void setState_TemperatureSpecificEntropy(double temp, double entrop);
    
        Q_INVOKABLE double getSpecificEnthalpy();
        Q_INVOKABLE double getSpecificEntropy();
        Q_INVOKABLE double getInternalEnergy();
        Q_INVOKABLE double getSpecificVolume();
        Q_INVOKABLE double getDensity();
        Q_INVOKABLE double getHeatCapacity_Cp();
        Q_INVOKABLE double getHeatCapacity_Cv();
        Q_INVOKABLE double getQuality();
        Q_INVOKABLE double getThermalConductivity();
        Q_INVOKABLE double getViscosity();
        Q_INVOKABLE double getTemperature();
        Q_INVOKABLE double getPressure();
    
    
    //    freesteam_se
    signals:
    
    public slots:
    };
    
    #endif // MYSTEAMCLASS_H
    Code:
    #include "mysteamclass.h"
    
    MySteamClass::MySteamClass(QObject *parent) : QObject(parent)
    {
    
    }
    
    
    void MySteamClass::setState_PressureTemperature(double pres, double temp){
        pressure = pres ;    temperature = temp;
    
        state = freesteam_set_pT(pres, temp);
    
        specificEnthalpy = freesteam_h(state);              //set the properties
        specificInternalEnergy = freesteam_u(state);
        specificVolume = freesteam_v(state);
        specificEntropy = freesteam_s(state);
        density= freesteam_rho(state);
        heatCapacity_Cp=freesteam_cp(state);
        heatCapacity_Cv= freesteam_cv(state);
        quality= freesteam_x(state);
        thermalConductivity= freesteam_k(state);
        viscosity= freesteam_mu(state);
    }
    
    void MySteamClass::setState_PressureSpecificInternalEnergy(double pres, double intEn){
    
        pressure = pres;  specificInternalEnergy = intEn;
    
        state =freesteam_set_ps(pres,intEn);
    
        specificEnthalpy = freesteam_h(state);              //set the properties
        temperature = freesteam_T(state);
        specificEntropy = freesteam_s(state);
        specificVolume = freesteam_v(state);
        density= freesteam_rho(state);
        heatCapacity_Cp=freesteam_cp(state);
        heatCapacity_Cv= freesteam_cv(state);
        quality= freesteam_x(state);
        thermalConductivity= freesteam_k(state);
        viscosity= freesteam_mu(state);
    }
    
    void MySteamClass::setState_PressureSpecificEntropy(double pres, double entrop){
         pressure = pres;  specificEntropy = entrop;
    
         state = freesteam_set_ps(pressure, specificEntropy);
    
         specificInternalEnergy = freesteam_u(state);
         specificEnthalpy = freesteam_h(state);
         temperature = freesteam_T(state);
         temperature = freesteam_T(state);
         density= freesteam_rho(state);
         heatCapacity_Cp=freesteam_cp(state);
         heatCapacity_Cv= freesteam_cv(state);
         quality= freesteam_x(state);
         thermalConductivity= freesteam_k(state);
         viscosity= freesteam_mu(state);
    }
    
    
    
    void MySteamClass::setState_PressureSpecificEnthalpy(double pres, double enthalp){
        pressure = pres; specificEnthalpy =  enthalp;
    
        state = freesteam_set_ph(pressure, specificEnthalpy);
    
        temperature = freesteam_T(state);
        specificInternalEnergy = freesteam_u(state);
        specificVolume = freesteam_v(state);
        specificEntropy = freesteam_s(state);
        density= freesteam_rho(state);
        heatCapacity_Cp=freesteam_cp(state);
        heatCapacity_Cv= freesteam_cv(state);
        quality= freesteam_x(state);
        thermalConductivity= freesteam_k(state);
        viscosity= freesteam_mu(state);
    }
    
    void MySteamClass::setState_PressureSpecificVolume(double pres, double vol){
        pressure = pres;  specificVolume = vol;
    
        state = freesteam_set_pv(pressure,specificVolume);
    
        specificEnthalpy = freesteam_h(state);              //set the properties
        specificInternalEnergy = freesteam_u(state);
        specificVolume = freesteam_v(state);
        specificEntropy = freesteam_s(state);
        density= freesteam_rho(state);
        heatCapacity_Cp=freesteam_cp(state);
        heatCapacity_Cv= freesteam_cv(state);
        quality= freesteam_x(state);
        thermalConductivity= freesteam_k(state);
        viscosity= freesteam_mu(state);
    }
    
    void MySteamClass::setState_TemperatureSpecificEntropy(double temp, double entrop){
        temperature = temp;   specificEntropy = entrop;
    
        state = freesteam_set_Ts(temperature, specificEntropy);
    
        pressure = freesteam_p(state);
        specificEnthalpy = freesteam_h(state);              //set the properties
        specificInternalEnergy = freesteam_u(state);
        specificVolume = freesteam_v(state);
        density= freesteam_rho(state);
        heatCapacity_Cp=freesteam_cp(state);
        heatCapacity_Cv= freesteam_cv(state);
        quality= freesteam_x(state);
        thermalConductivity= freesteam_k(state);
        viscosity= freesteam_mu(state);
    }
    
                                                 //-----------GETTERS----------\\
    
    double MySteamClass::getSpecificEnthalpy(){
        return specificEnthalpy;
    }
    
    
     double MySteamClass::getSpecificEntropy(){
         return specificEntropy;
     }
    
     double MySteamClass::getInternalEnergy(){
         return specificInternalEnergy;
     }
    
     double MySteamClass::getSpecificVolume(){
         return specificVolume;
     }
    
     double MySteamClass::getHeatCapacity_Cp(){
         return heatCapacity_Cp;
     }
    
     double MySteamClass::getHeatCapacity_Cv(){
         return heatCapacity_Cv;
     }
    
     double MySteamClass::getQuality(){
         return quality;
     }
    
     double MySteamClass::getThermalConductivity(){
         return thermalConductivity;
     }
    
     double MySteamClass::getViscosity(){
         return viscosity;
     }
    double MySteamClass::getDensity(){
        return density;
    }
    double MySteamClass::getTemperature(){
        return temperature;
    }
    double MySteamClass::getPressure(){
        return pressure;
    }

    And main.cpp.

    Code:
    extern "C" {
    
    #include <freesteam/steam_ps.h>
    #include <freesteam/steam_pT.h>
    #include <freesteam/region4.h>
    #include <stdio.h>
    }
    #include <iostream>
    #include <fstream>
    
    using namespace std;
    
    #include <QGuiApplication>
    #include <QQmlApplicationEngine>
    #include <QtQml>
    #include "mysteamclass.h"
    
    
    int main(int argc, char *argv[])
    {
        qmlRegisterType<MySteamClass>("MySteamClass",1,0,"MySteamClass");
    
        QGuiApplication app(argc, argv);
    
        QQmlApplicationEngine engine;
        engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
    
    
        return app.exec();
    }
    Thank you for the answer.
    Last edited by ding; 07-31-2015 at 02:27 PM. Reason: Added more info.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Build error
    By yusko63 in forum C++ Programming
    Replies: 5
    Last Post: 03-26-2010, 11:53 PM
  2. Build error in C
    By shaheel in forum C Programming
    Replies: 2
    Last Post: 12-03-2007, 08:06 AM
  3. Build Error
    By CodeMonkey in forum C++ Programming
    Replies: 4
    Last Post: 07-01-2007, 04:43 PM
  4. 0 compile error but 2 build error. need help please!
    By jibbles in forum C Programming
    Replies: 5
    Last Post: 08-30-2004, 04:30 PM
  5. Error on build....
    By Unregistered in forum C++ Programming
    Replies: 0
    Last Post: 03-21-2002, 10:19 AM

Tags for this Thread