IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
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

wxWidgets Discussion :

wxWidgets, CMake et CLion


Sujet :

wxWidgets

  1. #1
    Membre expert
    Avatar de Faith's Fall
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    1 740
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 1 740
    Points : 3 249
    Points
    3 249
    Par défaut wxWidgets, CMake et CLion
    Bonjour,

    J'ai un petit soucis avec la librairie wxWidgets sur mon IDE CLion, pour commencer :

    - J'utilise la dernière version de CLion avec MinGW dans sa version 64 bits sous Windows 10.
    - J'utilise le code source de wxWidget 3.1.0 que je compile avec la commande : make -f makefile.gcc UNICODE=1 MONOLITHIC=0 SHARED=0 USE_ODBC=1 USE_OPENGL=1 BUILD=release

    A noter que je peut aussi utiliser mingw-make.exe a la place de make. La compilation de la librairie ce passe sans aucun soucis, je n'ai aucune erreur et dans le dossier <wxhome>/lib, un dossier gcc_lib avec plein de fichier .a est créé.

    - Je place le répertoire de wxwidgets dans un dossier libext, a la racine du projet.

    - J'ai commencer un projet simple sur CLion (je suis pas pros de l'ide, et encore moins de CMake, que je découvre) avec 3 fichiers: wxHello.cpp, wxHello.h et le fichier CMake, CMakeLists.txt.

    Le contenu :

    wxHello.h

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    #ifndef WXHELLO_WXHELLO_H
    #define WXHELLO_WXHELLO_H
     
    #include <wx/wx.h>
     
    class wxHello : public wxApp {
    public:
        virtual bool OnInit();
    };
     
    DECLARE_APP(wxHello);
     
    #endif //WXHELLO_WXHELLO_H
    wxHello.cpp

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    #include "wxHello.h"
    IMPLEMENT_APP(wxHello);
     
     
    bool wxHello::OnInit() {
         wxMessageBox(_T("Bienvenue sur wxWidgets !"));    
         return false;
    }
    Et pour finir le fichier CMake CMakeLists.txt

    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
    cmake_minimum_required(VERSION 3.6)
    project(wxHello)
     
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -static")
     
    include_directories(
            includes
            libext/wx/include
    )
     
    link_directories(
            libs
            libext/wx/lib/gcc_lib
    )
     
    set(
            WXHELLO_SOURCES
            src/wxHello.cpp
            src/wxHello.h
    )
     
    add_executable(
            wxHello
            ${WXHELLO_SOURCES}
    )
    Le problème est là, CLion reconnait bien les fichiers .h de la librairie wxWidgets, mais a la compilation sa plante. Je pense parce que il utilise pas les fichiers .a nécessaire à la compilation. Le fait que j'ai rajouté le chemin sur link_directories à l'air de pas suffire.

    Et la je coince un peu

    PS: je met l'erreur que CLion/gcc m'affiche si cela peu aider:

    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
    "C:\Program Files (x86)\JetBrains\CLion 2016.2.1\bin\cmake\bin\cmake.exe" --build F:\JetBrains\CLion\system\cmake\generated\wxHello-389b4489\389b4489\Debug --target all -- -j 8
    Scanning dependencies of target wxHello
    [ 50%] Building CXX object CMakeFiles/wxHello.dir/src/wxHello.cpp.obj
    In file included from F:/Dev/Cpp/wxHello/libext/wx/include/wx/defs.h:20:0,
                     from F:/Dev/Cpp/wxHello/libext/wx/include/wx/wx.h:14,
                     from F:\Dev\Cpp\wxHello\src\wxHello.h:4,
                     from F:\Dev\Cpp\wxHello\src\wxHello.cpp:1:
    F:/Dev/Cpp/wxHello/libext/wx/include/wx/platform.h:136:22: fatal error: wx/setup.h: No such file or directory
     #include "wx/setup.h"
                          ^
    compilation terminated.
    mingw32-make.exe[2]: *** [CMakeFiles/wxHello.dir/src/wxHello.cpp.obj] Error 1
    mingw32-make.exe[1]: *** [CMakeFiles/wxHello.dir/all] Error 2
    mingw32-make.exe: *** [all] Error 2
    CMakeFiles\wxHello.dir\build.make:62: recipe for target 'CMakeFiles/wxHello.dir/src/wxHello.cpp.obj' failed
    CMakeFiles\Makefile2:66: recipe for target 'CMakeFiles/wxHello.dir/all' failed
    Makefile:82: recipe for target 'all' failed
    Merci d'avance.

  2. #2
    Membre averti Avatar de wxXav
    Homme Profil pro
    Développeur amateur
    Inscrit en
    Décembre 2008
    Messages
    214
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur amateur

    Informations forums :
    Inscription : Décembre 2008
    Messages : 214
    Points : 354
    Points
    354
    Par défaut
    Bonjour.

    Citation Envoyé par Faith's Fall Voir le message
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
     
    ......
    In file included from F:/Dev/Cpp/wxHello/libext/wx/include/wx/defs.h:20:0,
                     from F:/Dev/Cpp/wxHello/libext/wx/include/wx/wx.h:14,
                     from F:\Dev\Cpp\wxHello\src\wxHello.h:4,
                     from F:\Dev\Cpp\wxHello\src\wxHello.cpp:1:
    F:/Dev/Cpp/wxHello/libext/wx/include/wx/platform.h:136:22: fatal error: wx/setup.h: No such file or directory
    ......
    En fait, il manque un dossier d'includes, dans lequel se trouve le fichier "setup.h" contenant les options de compilation (ce qui permet par exemple de faire cohabiter plusieurs builds).
    D'après les arguments de la ligne de commande pour la compilation, il doit s'agit du sous-dossier lib/gcc_lib/mswu (à vérifier)

    Citation Envoyé par Faith's Fall Voir le message
    Et pour finir le fichier CMake CMakeLists.txt

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    ......
    include_directories(
            includes
            libext/wx/lib/gcc_lib/mswu
            libext/wx/include
    )
    ......
    Mais normalement, CMAKE possède un script de détection et de réglages des libs wxWidgets il me semble (quoique je ne suis pas certain qu'il soit déjà prêt pour wxWidgets-3.1.0).

    Xav'

  3. #3
    Membre expert
    Avatar de Faith's Fall
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    1 740
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 1 740
    Points : 3 249
    Points
    3 249
    Par défaut
    Merci pour ta réponse,

    Bon j'ai cela comme changement sur mon fichier CMakeLists.txt :

    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
    cmake_minimum_required(VERSION 3.6)project(wxHello)
     
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -static")
     
    include_directories(
            includes
            libext/wx/include
            libext/wx/lib/gcc_lib/mswu
    )
     
    link_directories(
            libs
            libext/wx/lib/gcc_lib
    )
     
    set(
            WX_LIBS
            libext/wx/lib/gcc_lib/libwxexpat.a
            libext/wx/lib/gcc_lib/libwxjpeg.a
            libext/wx/lib/gcc_lib/libwxmsw31u.a
            libext/wx/lib/gcc_lib/libwxmsw31u_gl.a
            libext/wx/lib/gcc_lib/libwxpng.a
            libext/wx/lib/gcc_lib/libwxregexu.a
            libext/wx/lib/gcc_lib/libwxscintilla.a
            libext/wx/lib/gcc_lib/libwxtiff.a
            libext/wx/lib/gcc_lib/libwxzlib.a
    )
     
    set(
            WXHELLO_SOURCES
            src/wxHello.cpp
            src/wxHello.h
    )
     
    add_executable(
            wxHello
            ${WXHELLO_SOURCES}
    )
     
    target_link_libraries(
            wxHello
            ${WX_LIBS}
    )
    Effectivement je n'ai plus l'erreur pour le setup.h. Mais maintenant j'ai cela :

    "C:\Program Files (x86)\JetBrains\CLion 2016.2.1\bin\cmake\bin\cmake.exe" --build F:\JetBrains\CLion\system\cmake\generated\wxHello-389b4489\389b4489\Debug --target all -- -j 8
    Scanning dependencies of target wxHello
    [ 50%] Building CXX object CMakeFiles/wxHello.dir/src/wxHello.cpp.obj
    [100%] Linking CXX executable F:\Dev\Cpp\wxHello\build\Debug\wxHello.exe
    C:/MinGW64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibext/wx/lib/gcc_lib/libwxexpat.a
    C:/MinGW64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibext/wx/lib/gcc_lib/libwxjpeg.a
    C:/MinGW64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibext/wx/lib/gcc_lib/libwxmsw31u.a
    C:/MinGW64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibext/wx/lib/gcc_lib/libwxmsw31u_gl.a
    C:/MinGW64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibext/wx/lib/gcc_lib/libwxpng.a
    C:/MinGW64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibext/wx/lib/gcc_lib/libwxregexu.a
    C:/MinGW64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibext/wx/lib/gcc_lib/libwxscintilla.a
    C:/MinGW64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibext/wx/lib/gcc_lib/libwxtiff.a
    C:/MinGW64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibext/wx/lib/gcc_lib/libwxzlib.a
    collect2.exe: error: ld returned 1 exit status
    CMakeFiles\wxHello.dir\build.make:96: recipe for target 'F:/Dev/Cpp/wxHello/build/Debug/wxHello.exe' failed
    CMakeFiles\Makefile2:66: recipe for target 'CMakeFiles/wxHello.dir/all' failed
    Makefile:82: recipe for target 'all' failed
    mingw32-make.exe[2]: *** [F:/Dev/Cpp/wxHello/build/Debug/wxHello.exe] Error 1
    mingw32-make.exe[1]: *** [CMakeFiles/wxHello.dir/all] Error 2
    mingw32-make.exe: *** [all] Error 2
    A noter que j'ai recompiler wxWidget avec les mêmes parametres sauf pour MONOLITHIC=1.

    Apparemment il trouve pas les fichiers .a malgré que cela soit indiqué

  4. #4
    Membre averti Avatar de wxXav
    Homme Profil pro
    Développeur amateur
    Inscrit en
    Décembre 2008
    Messages
    214
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur amateur

    Informations forums :
    Inscription : Décembre 2008
    Messages : 214
    Points : 354
    Points
    354
    Par défaut
    C'est bizarre.

    Est-ce que les fichiers libs (*.a) sont bien présents dans le dossier "libext/wx/lib/gcc_lib" ?

    Essaye de modifier l'ordre des dossiers de recherche des libs (mettre le dossier contenant les libs wxWidgets en premier).

    Il y a aussi une importance dans l'ordre dans lequel sont passés les libs à linker pour MinGW, mais tu n'aurais pas ce genre d'erreur (plutôt des "undefined reference to ...").

    Tu peux par contre essayer de ne mettre que les noms des libs, pas les chemins :
    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
    ......
    link_directories(
            libext/wx/lib/gcc_lib
            libs
    )
     
    set(
            WX_LIBS
            libwxmsw31u.a
            libwxexpat.a
            libwxjpeg.a
            libwxpng.a
            libwxregexu.a
            libwxtiff.a
            libwxzlib.a
    )
    ......
    Tu noteras également dans le code ci-dessus que j'ai supprimé les libs "gl" et "scintilla" (elles ne sont utiles que si tu utilises les fonctions opengl et/ou scintilla dans ton projet).

    Si je trouve un moment, j'essayerais de faire un petit projet wxWidgets avec un CMakeLists ressemblant au tien parce que comme ça, je ne vois pas trop ce qui peut coincer.

    @+
    Xav'

  5. #5
    Membre expert
    Avatar de Faith's Fall
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    1 740
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 1 740
    Points : 3 249
    Points
    3 249
    Par défaut
    Oui les fichiers .a sont bien dans le dossier (CLion les reconnait bien avec la complétion).

    Bon j'ai virer libs dans link_directories (inutile car vide) et virer le chemin des libs, ce qui donne :

    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
     
    cmake_minimum_required(VERSION 3.6)
    project(wxHello)
     
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -static")
     
    ###############################################################################
    # Répertoire include et libs
    ###############################################################################
     
    include_directories(
            includes
            libext/wx/include
            libext/wx/lib/gcc_lib/mswu
    )
     
    link_directories(
            libext/wx/lib/gcc_lib
    )
     
    ###############################################################################
    # Librairie WX (Fichier .a)
    ###############################################################################
     
    set(
            WX_LIBS
            libwxexpat.a
            libwxjpeg.a
            libwxmsw31u.a
            libwxpng.a
            libwxregexu.a
            libwxtiff.a
            libwxzlib.a
    )
     
    ###############################################################################
    # Sources du programme
    ###############################################################################
     
    set(
            WXHELLO_SOURCES
            src/wxHello.cpp
            src/wxHello.h
    )
     
    ###############################################################################
    # Création de l'executable
    ###############################################################################
     
    add_executable(
            wxHello
            ${WXHELLO_SOURCES}
    )
     
    ###############################################################################
    # Ajout de la librairie WX
    ###############################################################################
     
    target_link_libraries(
            wxHello
            ${WX_LIBS}
    )
    Mais maintenant j'ai :

    "C:\Program Files (x86)\JetBrains\CLion 2016.2.1\bin\cmake\bin\cmake.exe" --build F:\JetBrains\CLion\system\cmake\generated\wxHello-389b4489\389b4489\Debug --target all -- -j 8
    [ 50%] Linking CXX executable F:\Dev\Cpp\wxHello\build\Debug\wxHello.exe
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_dlmsw.o):dlmsw.cpp:(.text+0x595): undefined reference to `GetFileVersionInfoSizeW'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_dlmsw.o):dlmsw.cpp:(.text+0x686): undefined reference to `GetFileVersionInfoW'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_dlmsw.o):dlmsw.cpp:(.text+0x6a8): undefined reference to `VerQueryValueW'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_app.o):app.cpp:(.text+0x8452): undefined reference to `__imp_InitCommonControls'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_utilsgui.o):utilsgui.cpp:(.text+0xe4d): undefined reference to `__imp_SHAutoComplete'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_ownerdrw.o):ownerdrw.cpp:(.text+0x10e): undefined reference to `__imp_ImageList_Create'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_ownerdrw.o):ownerdrw.cpp:(.text+0x120): undefined reference to `__imp_ImageList_Add'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_ownerdrw.o):ownerdrw.cpp:(.text+0x149): undefined reference to `__imp_ImageList_Draw'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_ownerdrw.o):ownerdrw.cpp:(.text+0x154): undefined reference to `__imp_ImageList_Destroy'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_msw_spinbutt.o):spinbutt.cpp:(.text+0x6ec): undefined reference to `__imp_CreateUpDownControl'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_textentry.o):textentry.cpp:(.text+0x83e): undefined reference to `__imp_SHAutoComplete'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_mimetype.o):mimetype.cpp:(.text+0x155e): undefined reference to `__imp_AssocQueryStringW'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_imaglist.o):imaglist.cpp:(.text+0x6d): undefined reference to `__imp_ImageList_Destroy'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_imaglist.o):imaglist.cpp:(.text+0x426): undefined reference to `__imp_ImageList_GetImageCount'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_imaglist.o):imaglist.cpp:(.text+0x477): undefined reference to `__imp_ImageList_GetImageCount'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_imaglist.o):imaglist.cpp:(.text+0x4be): undefined reference to `__imp_ImageList_GetIconSize'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_imaglist.o):imaglist.cpp:(.text+0x541): undefined reference to `__imp_ImageList_GetIcon'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_imaglist.o):imaglist.cpp:(.text+0x659): undefined reference to `__imp_ImageList_Remove'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_imaglist.o):imaglist.cpp:(.text+0xf1c): undefined reference to `__imp_ImageList_Add'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_imaglist.o):imaglist.cpp:(.text+0x1839): undefined reference to `__imp_ImageList_Replace'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_imaglist.o):imaglist.cpp:(.text+0x24d9): undefined reference to `__imp_ImageList_SetBkColor'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_imaglist.o):imaglist.cpp:(.text+0x252c): undefined reference to `__imp_ImageList_Draw'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_imaglist.o):imaglist.cpp:(.text+0x4e8b): undefined reference to `__imp_ImageList_GetImageInfo'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_imaglist.o):imaglist.cpp:(.text+0x5327): undefined reference to `__imp_ImageList_ReplaceIcon'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_imaglist.o):imaglist.cpp:(.text+0x5c81): undefined reference to `__imp_ImageList_ReplaceIcon'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_imaglist.o):imaglist.cpp:(.text+0x64e3): undefined reference to `__imp_ImageList_Create'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_imaglist.o):imaglist.cpp:(.text+0x6e4b): undefined reference to `__imp_ImageList_AddMasked'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_msw_listctrl.o):listctrl.cpp:(.text+0x835): undefined reference to `__imp_ImageList_GetImageCount'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_msw_listctrl.o):listctrl.cpp:(.text+0x926): undefined reference to `__imp_ImageList_Draw'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_msw_listctrl.o):listctrl.cpp:(.text+0x943): undefined reference to `__imp_ImageList_GetIconSize'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_treectrl.o):treectrl.cpp:(.text+0xb526): undefined reference to `__imp_ImageList_Add'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_treectrl.o):treectrl.cpp:(.text+0xb543): undefined reference to `__imp_ImageList_Copy'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_dragimag.o):dragimag.cpp:(.text+0x1a0): undefined reference to `__imp_ImageList_BeginDrag'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_dragimag.o):dragimag.cpp:(.text+0x23d): undefined reference to `__imp_ImageList_ReplaceIcon'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_dragimag.o):dragimag.cpp:(.text+0x263): undefined reference to `__imp_ImageList_SetDragCursorImage'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_dragimag.o):dragimag.cpp:(.text+0x3f3): undefined reference to `__imp_ImageList_Create'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_dragimag.o):dragimag.cpp:(.text+0x3115): undefined reference to `__imp_ImageList_DragMove'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_dragimag.o):dragimag.cpp:(.text+0x322d): undefined reference to `__imp_ImageList_DragEnter'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_dragimag.o):dragimag.cpp:(.text+0x32b6): undefined reference to `__imp_ImageList_DragLeave'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_dragimag.o):dragimag.cpp:(.text+0x3340): undefined reference to `__imp_ImageList_EndDrag'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_dragimag.o):dragimag.cpp:(.text+0x3c27): undefined reference to `__imp_ImageList_Destroy'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_dragimag.o):dragimag.cpp:(.text+0x3c8c): undefined reference to `__imp_ImageList_Create'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_dragimag.o):dragimag.cpp:(.text+0x3cd3): undefined reference to `__imp_ImageList_Add'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_dragimag.o):dragimag.cpp:(.text+0x43d5): undefined reference to `__imp_ImageList_Add'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_dragimag.o):dragimag.cpp:(.text+0x44f7): undefined reference to `__imp_ImageList_Destroy'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_dragimag.o):dragimag.cpp:(.text+0x4543): undefined reference to `__imp_ImageList_Create'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_dragimag.o):dragimag.cpp:(.text+0x4566): undefined reference to `__imp_ImageList_ReplaceIcon'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_dragimag.o):dragimag.cpp:(.text+0x4d4d): undefined reference to `__imp_ImageList_Destroy'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_dragimag.o):dragimag.cpp:(.text+0x4d5c): undefined reference to `__imp_ImageList_Destroy'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_dragimag.o):dragimag.cpp:(.text+0x53ac): undefined reference to `__imp_ImageList_Destroy'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_dragimag.o):dragimag.cpp:(.text+0x546c): undefined reference to `__imp_ImageList_Destroy'
    collect2.exe: error: ld returned 1 exit status
    mingw32-make.exe[2]: *** [F:/Dev/Cpp/wxHello/build/Debug/wxHello.exe] Error 1
    mingw32-make.exe[1]: *** [CMakeFiles/wxHello.dir/all] Error 2
    mingw32-make.exe: *** [all] Error 2
    CMakeFiles\wxHello.dir\build.make:96: recipe for target 'F:/Dev/Cpp/wxHello/build/Debug/wxHello.exe' failed
    CMakeFiles\Makefile2:66: recipe for target 'CMakeFiles/wxHello.dir/all' failed
    Makefile:82: recipe for target 'all' failed
    Je pense que cela viens de mon code simpliste (j'ai pris un code exemple assez simpliste, mon but est surtout de pouvoir utiliser wxWidgets avec CMake). Mais dans l'ensemble cela est assez nouveau pour moi.

    Merci en tout cas.

  6. #6
    Membre averti Avatar de wxXav
    Homme Profil pro
    Développeur amateur
    Inscrit en
    Décembre 2008
    Messages
    214
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur amateur

    Informations forums :
    Inscription : Décembre 2008
    Messages : 214
    Points : 354
    Points
    354
    Par défaut
    Bon : apparemment, ça progresse dans le bon sens.

    Citation Envoyé par Faith's Fall Voir le message
    Je pense que cela viens de mon code simpliste (j'ai pris un code exemple assez simpliste, mon but est surtout de pouvoir utiliser wxWidgets avec CMake). Mais dans l'ensemble cela est assez nouveau pour moi.
    Non : ça ne vient pas de ton code (enfin si : du code de ton CMakeLists).
    Les "undefined refenrence" que tu obtiens maintenant concernent les libs relatives aux API Windows.
    Il faut donc que tu les rajoutes après les libs wxWidgets.

    Essaye déjà de rajouter "libcomctl32.a", ça devrait en enlever pas mal.
    Il n'y a que pour les 3 premières erreurs que je ne sais pas trop : si j'en crois MSDN (par exemple, sur cette page pour "VerQueryValue", il faudrait une lib nommée "Mincore.lib" ce qui pour MinGW donnerait "libmincore.a", mais je ne la trouve pas dans mon installation).

    Tu as quelle version de MinGW ? Est-ce la version officielle, ou la version "TDM" ?

    Citation Envoyé par Faith's Fall Voir le message
    Merci en tout cas.
    De rien...

  7. #7
    Membre expert
    Avatar de Faith's Fall
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    1 740
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 1 740
    Points : 3 249
    Points
    3 249
    Par défaut
    Citation Envoyé par wxXav Voir le message
    Tu as quelle version de MinGW ? Est-ce la version officielle, ou la version "TDM" ?
    Mon MinGW est la version 6.2.0 en 64 bit. http://mingw-w64.org/

    J'ai rajouter libcomctl32.a :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
     
    set(
            WX_LIBS
            libwxexpat.a
            libwxjpeg.a
            libwxmsw31u.a
            libwxpng.a
            libwxregexu.a
            libwxtiff.a
            libwxzlib.a
            libcomctl32.a
     
    )
    et cela me retourne :

    "C:\Program Files (x86)\JetBrains\CLion 2016.2.1\bin\cmake\bin\cmake.exe" --build F:\JetBrains\CLion\system\cmake\generated\wxHello-389b4489\389b4489\Debug --target all -- -j 8
    [ 50%] Linking CXX executable F:\Dev\Cpp\wxHello\build\Debug\wxHello.exe
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_dlmsw.o):dlmsw.cpp:(.text+0x595): undefined reference to `GetFileVersionInfoSizeW'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_dlmsw.o):dlmsw.cpp:(.text+0x686): undefined reference to `GetFileVersionInfoW'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_dlmsw.o):dlmsw.cpp:(.text+0x6a8): undefined reference to `VerQueryValueW'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_utilsgui.o):utilsgui.cpp:(.text+0xe4d): undefined reference to `__imp_SHAutoComplete'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_textentry.o):textentry.cpp:(.text+0x83e): undefined reference to `__imp_SHAutoComplete'
    F:/Dev/Cpp/wxHello/libext/wx/lib/gcc_lib\libwxmsw31u.a(monolib_mimetype.o):mimetype.cpp:(.text+0x155e): undefined reference to `__imp_AssocQueryStringW'
    collect2.exe: error: ld returned 1 exit status
    mingw32-make.exe[2]: *** [F:/Dev/Cpp/wxHello/build/Debug/wxHello.exe] Error 1
    CMakeFiles\wxHello.dir\build.make:96: recipe for target 'F:/Dev/Cpp/wxHello/build/Debug/wxHello.exe' failed
    CMakeFiles\Makefile2:66: recipe for target 'CMakeFiles/wxHello.dir/all' failed
    mingw32-make.exe[1]: *** [CMakeFiles/wxHello.dir/all] Error 2
    mingw32-make.exe: *** [all] Error 2
    Makefile:82: recipe for target 'all' failed
    Je précise que n'importe quel programme en C++ compile parfaitement sans avoir besoin de librairie en plus, le problème est venu via wxwidgets. Bon en tout cas j'avance :p

  8. #8
    Membre expert
    Avatar de Faith's Fall
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    1 740
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 1 740
    Points : 3 249
    Points
    3 249
    Par défaut
    Bon je viens de trouver :

    Tu as bien raison il fallait rajouter libcomctl32.a mais également shlwapi.a et version.a.

    La je n'ai plus d'erreur. Bon c'est résolu :p

    PS: Trouvé ici pour info : https://forums.wxwidgets.org/viewtopic.php?t=41973

    Merci.

  9. #9
    Membre averti Avatar de wxXav
    Homme Profil pro
    Développeur amateur
    Inscrit en
    Décembre 2008
    Messages
    214
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur amateur

    Informations forums :
    Inscription : Décembre 2008
    Messages : 214
    Points : 354
    Points
    354
    Par défaut
    Citation Envoyé par Faith's Fall Voir le message
    Mon MinGW est la version 6.2.0 en 64 bit. http://mingw-w64.org/
    Pour ma part, je tourne avec MinGW-TDM.

    Citation Envoyé par Faith's Fall Voir le message
    Je précise que n'importe quel programme en C++ compile parfaitement sans avoir besoin de librairie en plus, le problème est venu via wxwidgets. Bon en tout cas j'avance :p
    S'il ne s'agit pas de programmes compliqués, ça peut être normal (utilisation de libs "classiques").

    Pour "AssocQueryString", libshlwapi.a devrait résoudre le problème (ainsi que pour "SHAutoComplete") .
    Par contre, je n'ai toujours pas de solution pour les 3 premières erreurs.
    Je ne suis pas arrivé à les avoir de mon côté avec ma version de MinGw (mais je n'utilise pas les libs "monolithiques").
    Normalement, pour ces 3 fonctions (GetFileVersionInfoSize, GetFileVersionInfo et VerQueryValue), il faudrait normalement, une lib "libmincore.a". Essaye de l'ajouter à la liste (des fois que ta version de MinGW la possède).

    Sinon, essaye de compiler l'exemple minimal en ligne de commande, avec les mêmes paramètres que ceux que tu as utilisé pour compiler les libs wxWidgets : tu arriveras peut-être à voir quelle est la lib manquante.

    Tiens moi au courant en tout cas.

    @+
    Xav'

  10. #10
    Membre expert
    Avatar de Faith's Fall
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    1 740
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 1 740
    Points : 3 249
    Points
    3 249
    Par défaut
    Sinon juste une petite question (qui a rien a voir avec le sujet), pourquoi a tu choisi la version TDM mingw au lieu d'une autre ?

    Merci.

  11. #11
    Membre averti Avatar de wxXav
    Homme Profil pro
    Développeur amateur
    Inscrit en
    Décembre 2008
    Messages
    214
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur amateur

    Informations forums :
    Inscription : Décembre 2008
    Messages : 214
    Points : 354
    Points
    354
    Par défaut
    Je la trouve plus simple à installer, et elle était à une période mieux compatible avec wxWidgets.
    De plus, c'est la version qui est fournie officiellement avec Code::Blocks que j'utilise la plupart du temps.

    J'en ai d'ailleurs 6 versions différentes installées et qui cohabitent sans problème : 4.8.1, 4.9.2, 5.1.0 en version 32 et 64 bits.

    Le seul problème que je rencontre depuis quelques temps, c'est qu'il est devenu impossible de compiler wxWidgets-3.1.x en mode 64bits/Debug/Dynamique/Monolithique (j'obtiens un dépassement de mémoire lors du link de la dll principale).

    D'ailleurs, à l'occasion, est-ce que tu pourrais essayer pour voir si ça passe avec la version officielle (si tu as du temps à perdre : sinon, pas de problème) ?

    @+
    Xav'

  12. #12
    Membre expert
    Avatar de Faith's Fall
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    1 740
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 1 740
    Points : 3 249
    Points
    3 249
    Par défaut
    Je viens de tester la TDM est pareil pour mon problème il faut bien mettre les fichier .a cité un peu plus haut pour que cela marche. Je pense que je vais garder cette version pour le moment. Par contre la derniere maj date de 2015 me semble, donc gcc est sans doute pas la dernière version, enfin bon tant que cela marche.

    Pour la DLL, toujours bon à savoir mais la je peut pas tester, car l'installeur de mingw-64 ne trouve pas les reposity pour le moment (installation via le net), mais dès que cela remarche (et si j'y pense) je testerais

    PS ma version est plutot: https://sourceforge.net/projects/mingw-w64/ (ce n'est pas une version officielle, juste une distribution parmi d'autres), pas l'autre cité plus haut (qui a l'air plus complet (y a la sdl, et autre libs en plus mais un gcc assez vieux 4.x). Ils ont le meme nom d'où la confusion.

    Citation Envoyé par wxXav Voir le message
    D'ailleurs, à l'occasion, est-ce que tu pourrais essayer pour voir si ça passe avec la version officielle (si tu as du temps à perdre : sinon, pas de problème) ?
    Bon j'ai pas pu tester avec minGW64 (raison expliqué plus haut) mais j'ai tester avec la derniere version de la TDM avec wxwidget compiler en 64bits/Release/dynamique/monolithique, et cela passe bien.

    J'ai bien eu quelques avertissement a la compilation de la librairie mais aucune erreur et à l'utilisation aucun soucis non plus signaler. Tu devrais tester peut etre en build release et non debug. Après j'ai tester avec un programme bidon, peut etre que cela merde avec un programme plus complexe.

  13. #13
    Membre averti Avatar de wxXav
    Homme Profil pro
    Développeur amateur
    Inscrit en
    Décembre 2008
    Messages
    214
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur amateur

    Informations forums :
    Inscription : Décembre 2008
    Messages : 214
    Points : 354
    Points
    354
    Par défaut
    Citation Envoyé par Faith's Fall Voir le message
    Bon j'ai pas pu tester avec minGW64 (raison expliqué plus haut) mais j'ai tester avec la derniere version de la TDM avec wxwidget compiler en 64bits/Release/dynamique/monolithique, et cela passe bien.
    En build release, oui, il n'y a aucun problème, mais en build debug, ça ne passe normalement pas (il n'y a je crois qu'avec la version 4.9.2 que ça passe si mes souvenirs sont exacts).
    Le processus de link monte à 2Go de mémoire utilisée, puis c'est le plantage

    @+
    Xav'

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. wxWidgets : connaître l'etat d'un bouton !
    Par FSF_Sterl dans le forum wxWidgets
    Réponses: 5
    Dernier message: 14/08/2004, 08h55
  2. PB d'installation wxwidgets BCB6
    Par PsychicStorm dans le forum C++Builder
    Réponses: 3
    Dernier message: 18/05/2004, 16h02
  3. Réponses: 1
    Dernier message: 16/05/2004, 17h56
  4. wxWidgets - besoins d'aide...
    Par barbarello dans le forum wxWidgets
    Réponses: 2
    Dernier message: 07/05/2004, 09h33

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo