Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Bibliothèques C++ Discussion :

soucis compilation conjointe avec cimg et iostream


Sujet :

Bibliothèques C++

  1. #1
    Membre à l'essai
    soucis compilation conjointe avec cimg et iostream
    Bonjour,

    à la compilation du code tout simple suivant :
    Code :Sélectionner tout -Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
     
    #include "CImg.h"
    #include <iostream>
     
    using namespace cimg_library;
     
    int main()
    {
    	return 0;
    }



    j'ai plein d'erreurs du genre :
    Code :Sélectionner tout -Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    $ g++ -std=c++14  -I/usr/X11R6/include -I/usr/X11R6/include/X11 -L/usr/X11R6/lib -L/usr/X11R6/lib/X11 -lX11 test_cout.cpp -o test_cout
    In file included from test_cout.cpp:2:
    In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/iostream:38:
    In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/ios:216:
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__locale:71:20: error:
          use of undeclared identifier 'LC_COLLATE_MASK'
            collate  = LC_COLLATE_MASK,
                       ^
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__locale:72:20: error:
          use of undeclared identifier 'LC_CTYPE_MASK'
            ctype    = LC_CTYPE_MASK,
                       ^
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__locale:73:20: error:
          use of undeclared identifier 'LC_MONETARY_MASK'
            monetary = LC_MONETARY_MASK,
                       ^
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__locale:74:20: error:
          use of undeclared identifier 'LC_NUMERIC_MASK'
            numeric  = LC_NUMERIC_MASK,
                       ^
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__locale:75:20: error:
          use of undeclared identifier 'LC_TIME_MASK'
            time     = LC_TIME_MASK,
                       ^
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__locale:76:20: error:
          use of undeclared identifier 'LC_MESSAGES_MASK'
            messages = LC_MESSAGES_MASK,
                       ^
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__locale:284:5: error:
          unknown type name 'locale_t'; did you mean 'locale'?
        locale_t __l;
        ^
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__locale:60:24: note:
          'locale' declared here
    class _LIBCPP_TYPE_VIS locale
                           ^
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__locale:303:5: error:
          unknown type name 'locale_t'; did you mean 'locale'?
        locale_t __l;
        ^
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__locale:60:24: note:
          'locale' declared here
    class _LIBCPP_TYPE_VIS locale
                           ^
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__locale:662:5: error:
          unknown type name 'locale_t'; did you mean 'locale'?
        locale_t __l;
        ^
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__locale:60:24: note:
          'locale' declared here
    class _LIBCPP_TYPE_VIS locale
                           ^
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__locale:680:5: error:
          unknown type name 'locale_t'; did you mean 'locale'?
        locale_t __l;
        ^
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__locale:60:24: note:
          'locale' declared here
    class _LIBCPP_TYPE_VIS locale
                           ^
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__locale:912:5: error:
          unknown type name 'locale_t'; did you mean 'locale'?
        locale_t __l;
        ^
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__locale:60:24: note:
          'locale' declared here
    class _LIBCPP_TYPE_VIS locale
                           ^
    In file included from test_cout.cpp:2:
    In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/iostream:40:
    In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/istream:163:
    In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/ostream:140:
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/locale:229:31: error:
          unknown type name 'locale_t'; did you mean 'locale'?
    typedef _VSTD::remove_pointer<locale_t>::type __locale_struct;
                                  ^
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__locale:60:24: note:
          'locale' declared here
    class _LIBCPP_TYPE_VIS locale
                           ^
    In file included from test_cout.cpp:2:
    In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/iostream:40:
    In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/istream:163:
    In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/ostream:140:
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/locale:230:54: error:
          use of undeclared identifier 'freelocale'; did you mean 'setlocale'?
    typedef _VSTD::unique_ptr<__locale_struct, decltype(&freelocale)> __loca...
                                                         ^
    /usr/include/locale.h:53:8: note: 'setlocale' declared here
    char            *setlocale(int, const char *);
                     ^
    In file included from test_cout.cpp:2:
    In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/iostream:40:
    In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/istream:163:
    In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/ostream:140:
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/locale:874:26: error:
          use of undeclared identifier 'strtoll_l'
            long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
                             ^
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/locale:914:35: error:
          use of undeclared identifier 'strtoull_l'
            unsigned long long __ll = strtoull_l(__a, &__p2, __base, _LIBCPP...
                                      ^
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/locale:944:28: error:
          use of undeclared identifier 'strtold_l'; did you mean 'strtoll'?
            long double __ld = strtold_l(__a, &__p2, _LIBCPP_GET_C_LOCALE);
                               ^
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cstdlib:114:9: note:
          'strtoll' declared here
    using ::strtoll;
            ^
    In file included from test_cout.cpp:2:
    In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/iostream:40:
    In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/istream:163:
    In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/ostream:140:
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/locale:1192:9: error:
          use of undeclared identifier 'sscanf_l'
        if (sscanf_l(__buf.c_str(), _LIBCPP_GET_C_LOCALE, "%p", &__v) != 1)
            ^
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/locale:1300:18: error:
          use of undeclared identifier 'isxdigit_l'; did you mean 'isxdigit'?
                if (!isxdigit_l(*__ns, _LIBCPP_GET_C_LOCALE))
                     ^
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cctype:74:9: note:
          'isxdigit' declared here
    using ::isxdigit;
            ^
    In file included from test_cout.cpp:2:
    In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/iostream:40:
    In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/istream:163:
    In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/ostream:140:
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/locale:1300:18: error:
          too many arguments to function call, expected 1, have 2; did you mean
          '::std::isxdigit'?
                if (!isxdigit_l(*__ns, _LIBCPP_GET_C_LOCALE))
                     ^~~~~~~~~~
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cctype:74:9: note:
          '::std::isxdigit' declared here
    using ::isxdigit;
            ^
    fatal error: too many errors emitted, stopping now [-ferror-limit=]
    20 errors generated.



    Si je commente la ligne <iostream>, la compilation se déroule sans soucis !?

    J'arrive à utiliser cimg et iostream séparément, mais pas en même temps dans le même programme !!! Bizarre, non ?

    Mes recherches de solution n'ont rien donné. J'ai réinstallé Command_Line_Tools_macOS_10.11_for_Xcode_8.2 sans plus de succès
    Pour info, je suis sous OSX el capitan, j'utilise X11 pour l'affichage. Je n'utilise pas XCode, mais directement g++ dans le terminal.

    Je pense que ça doit être quelque chose de simple, mais quoi ??

    Merci par avance pour toute réponse.

  2. #2
    Membre à l'essai
    Je me réponds à moi-même... mais aussi pour celles ou ceux qui auront passé de leur temps pour lire mon post précédent.

    J'ai trouvé de manière empirique une solution à mon soucis de compilation. J'utilise la commande suivante :
    Code :Sélectionner tout -Visualiser dans une fenêtre à part
    1
    2
     
    g++ -std=c++14  -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 test_cout.cpp -o test_cout