wxWidget : résoudre l'erreur de compilation "undefined reference to `_IID_IPersistFile'", "undefined reference to `glFrustum'", etc.
Rédigé par Benjamin Billet -
Classé dans : Projet similarity-finder -
Mots clés : cygwin, wxwidget
g++ -shared -o /home/win7/wxWidgets-3.0.2/lib/cygwxbase30u_gcc_custom-0.dll basedll_version_rc.o basedll_any.o basedll_appbase.o basedll_arcall.o basedll_arcfind.o basedll_archive.o basedll_arrstr.o basedll_base64.o basedll_clntdata.o basedll_cmdline.o basedll_config.o basedll_convauto.o basedll_datetime.o basedll_datetimefmt.o basedll_datstrm.o basedll_dircmn.o basedll_dynarray.o basedll_dynlib.o basedll_dynload.o basedll_encconv.o basedll_evtloopcmn.o basedll_extended.o basedll_ffile.o basedll_file.o basedll_fileback.o basedll_fileconf.o basedll_filefn.o basedll_filename.o basedll_filesys.o basedll_filtall.o basedll_filtfind.o basedll_fmapbase.o basedll_fs_arc.o basedll_fs_filter.o basedll_hash.o basedll_hashmap.o basedll_init.o basedll_intl.o basedll_ipcbase.o basedll_languageinfo.o basedll_list.o basedll_log.o basedll_longlong.o basedll_memory.o basedll_mimecmn.o basedll_module.o basedll_mstream.o basedll_numformatter.o basedll_object.o basedll_platinfo.o basedll_powercmn.o basedll_process.o basedll_regex.o basedll_stdpbase.o basedll_sstream.o basedll_stdstream.o basedll_stopwatch.o basedll_strconv.o basedll_stream.o basedll_string.o basedll_stringimpl.o basedll_stringops.o basedll_strvararg.o basedll_sysopt.o basedll_tarstrm.o basedll_textbuf.o basedll_textfile.o basedll_threadinfo.o basedll_common_time.o basedll_timercmn.o basedll_timerimpl.o basedll_tokenzr.o basedll_translation.o basedll_txtstrm.o basedll_unichar.o basedll_uri.o basedll_ustring.o basedll_variant.o basedll_wfstream.o basedll_wxcrt.o basedll_wxprintf.o basedll_xlocale.o basedll_xti.o basedll_xtistrm.o basedll_zipstrm.o basedll_zstream.o basedll_fswatchercmn.o basedll_fswatcherg.o basedll_basemsw.o basedll_crashrpt.o basedll_debughlp.o basedll_dde.o basedll_msw_dir.o basedll_dlmsw.o basedll_evtloopconsole.o basedll_msw_mimetype.o basedll_power.o basedll_regconf.o basedll_registry.o basedll_msw_snglinst.o basedll_msw_stackwalk.o basedll_msw_stdpaths.o basedll_msw_thread.o basedll_timer.o basedll_msw_utils.o basedll_msw_utilsexc.o basedll_fswatcher.o basedll_event.o basedll_fs_mem.o basedll_msgout.o basedll_utilscmn.o basedll_main.o basedll_mslu.o basedll_volume.o -L/home/win7/wxWidgets-3.0.2/lib -Wl,--out-implib=/home/win7/wxWidgets-3.0.2/lib/libwx_baseu-3.0.dll.a -lwxregexu-3.0 -lz -lrpcrt4 -loleaut32 -lole32 -luuid -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32 -ladvapi32 -lwsock32 -lgdi32 -lkernel32 -luser32 -lz -lrpcrt4 -loleaut32 -lole32 -luuid -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32 -ladvapi32 -lwsock32 -lgdi32 -lkernel32 -luser32 basedll_filename.o:filename.cpp:(.text+0x511c): undefined reference to `IID_IShellLinkW' basedll_filename.o:filename.cpp:(.text+0x5162): undefined reference to `IID_IPersistFile' collect2: error: ld returned 1 exit status Makefile:15531: recipe for target '/home/win7/wxWidgets-3.0.2/lib/cygwxbase30u_gcc_custom-0.dll' failed make: *** [/home/win7/wxWidgets-3.0.2/lib/cygwxbase30u_gcc_custom-0.dll] Error 1
Cette erreur se produit lorsque libuuid-devel est installé, conduisant l'option -luuid à lier /usr/lib/libuuid.a au lieu de /usr/lib/w32api/libuuid.a. Pour résoudre ce problème, il est nécessaire d'éditer le fichier Makefile et d'ajouter -L /usr/lib/w32api à la variable LDFLAGS. Ainsi, ayant connaissance du répertoire approprié, g++ va lier la bonne librairie.
Une fois ce problème résolu, une autre erreur survient un peu plus tard, indiquant notamment que des éléments d'OpenGL sont manquants :
g++ -shared -o /home/win7/wxWidgets-3.0.2/lib/cygwxmsw30u_gl_gcc_custom-0.dll gldll_version_rc.o gldll_glcmn.o gldll_msw_glcanvas.o -L/home/win7/wxWidgets-3.0.2/lib -Wl,--out-implib=/home/win7/wxWidgets-3.0.2/lib/libwx_mswu_gl-3.0.dll.a -L /usr/lib/w32api -lwxtiff-3.0 -lwxjpeg-3.0 -lwxpng-3.0 -lwxregexu-3.0 -lwxexpat-3.0 -lz -lrpcrt4 -loleaut32 -lole32 -luuid -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32 -ladvapi32 -lwsock32 -lgdi32 -lkernel32 -luser32 -lwx_mswu_core-3.0 -lwx_baseu-3.0 -lopengl32 -lglu32 -lz -lrpcrt4 -loleaut32 -lole32 -luuid -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32 -ladvapi32 -lwsock32 -lgdi32 -lkernel32 -luser32 gldll_glcmn.o:glcmn.cpp:(.text+0x363): undefined reference to `glFrustum' gldll_glcmn.o:glcmn.cpp:(.text+0x428): undefined reference to `glGetBooleanv' gldll_glcmn.o:glcmn.cpp:(.text+0x91a): undefined reference to `glColor3f' gldll_glcmn.o:glcmn.cpp:(.text+0xae1): undefined reference to `glIndexi' gldll_glcmn.o:glcmn.cpp:(.text+0x371): undefined reference to `glBegin' gldll_glcmn.o:glcmn.cpp:(.text+0x381): undefined reference to `glTexCoord2f' gldll_glcmn.o:glcmn.cpp:(.text+0x391): undefined reference to `glVertex3f' gldll_glcmn.o:glcmn.cpp:(.text+0x3a1): undefined reference to `glNormal3f' gldll_glcmn.o:glcmn.cpp:(.text+0x3b1): undefined reference to `glColor4f' gldll_glcmn.o:glcmn.cpp:(.text+0x3c1): undefined reference to `glColor3f' gldll_glcmn.o:glcmn.cpp:(.text+0x3d1): undefined reference to `glEnd' collect2: error: ld returned 1 exit status Makefile:16086: recipe for target '/home/win7/wxWidgets-3.0.2/lib/cygwxmsw30u_gl_gcc_custom-0.dll' failed make: *** [/home/win7/wxWidgets-3.0.2/lib/cygwxmsw30u_gl_gcc_custom-0.dll] Error 1
Il semble que le lien avec OpenGL ne soit pas fait et doive être ajouté. De la même façon que le problème précédent, il est nécessaire d'aller modifier le fichier Makefile. Il suffit de trouver la variable EXTRALIBS_OPENGL et d'y ajouter -lGl.