Building minimal.cpp Sample on Eclipse - Several "undefined reference to ..."

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
User avatar
TukingFypo
In need of some credit
In need of some credit
Posts: 8
Joined: Tue Jan 22, 2019 1:16 pm

Building minimal.cpp Sample on Eclipse - Several "undefined reference to ..."

Post by TukingFypo » Mon Jan 28, 2019 2:20 pm

Any Ideas???

Thanks in advance!!!

P.S.: Totally LOST. Desperate ;-)


wxWidgets Version:
=================
wxWidgets-3.1.2


OS:
===
Win7 64bits


MinGW Compiler:
===============
v.6.3.0 - Target: mingw32


wxWidgets Build Command:
========================
mingw32-make -f makefile.gcc (NO ERRORS DURING BUILD - minimal sample compiled/run fine)


IDE:
====
Eclipse 2018-12


Project Settings (minimal.cpp)
===========================

C/C++ General | Path and Symbols | Includes Tab | GNU C++ | Include directories:
- C:/wxWidgets-3.1.2/lib/gcc_lib/mswud
- C:/wxWidgets-3.1.2/include

C/C++ General | Path and Symbols | Symbols Tab | GNU C++ | Sysmbol:
- _WINDOWS
- __WXMSW__
- _DEBUG
-__WXDEBUG__

C/C++ General | Path and Symbols | Library Paths Tab:
- C:/wxWidgets-3.1.2/lib/gcc_lib

C/C++ General | Path and Symbols | Libraries Tab:
- All 22 library files added without "lib" prefix and without ".lib" extension

MinGW C++ Linker | Expert settings | Command line pattern:
- Changed to ${COMMAND} ${INPUTS} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} (${INPUTS} at the begining, after ${COMMAND})


============
=== Issue: ===
============

Several "undefined reference to ..." on Eclipse console window.


Eclipse Build Log File: (see mixed slashs and backslashes)
==========================================================
11:43:23 **** Incremental Build of configuration Debug for project wx06 ****
Info: Internal Builder is used for build
g++ main.o -lwxbase31ud -lwxbase31ud_net -lwxbase31ud_xml -lwxexpatd -lwxjpegd -lwxmsw31ud_adv -lwxmsw31ud_aui -lwxmsw31ud_core -lwxmsw31ud_gl -lwxmsw31ud_html -lwxmsw31ud_media -lwxmsw31ud_propgrid -lwxmsw31ud_ribbon -lwxmsw31ud_richtext -lwxmsw31ud_stc -lwxmsw31ud_webview -lwxmsw31ud_xrc -lwxpngd -lwxregexud -lwxscintillad -lwxtiffd -lwxzlibd -LC:/wxWidgets-3.1.2/lib/gcc_lib -owx06.exe
C:/wxWidgets-3.1.2/lib/gcc_lib/libwxbase31ud.a(baselib_filename.o): In function `ZNK10wxFileName17GetShortcutTargetERK8wxStringRS0_PS0_':
C:\wxWidgets-3.1.2\build\msw/../../src/common/filename.cpp:1635: undefined reference to `[email protected]'
C:\wxWidgets-3.1.2\build\msw/../../src/common/filename.cpp:1641: undefined reference to `IID_IPersistFile'
C:/wxWidgets-3.1.2/lib/gcc_lib/libwxbase31ud.a(baselib_filename.o): In function `Z15wxOleInitializev':
C:\wxWidgets-3.1.2\build\msw/../../include/wx/msw/ole/oleutils.h:42: undefined reference to `[email protected]'
.
.
.
.
C:/wxWidgets-3.1.2/lib/gcc_lib/libwxmsw31ud_core.a(corelib_filedlg.o): In function `DoShowCommFileDialog':
C:\wxWidgets-3.1.2\build\msw/../../src/msw/filedlg.cpp:362: undefined reference to `[email protected]'
C:\wxWidgets-3.1.2\build\msw/../../src/msw/filedlg.cpp:362: undefined reference to `[email protected]'
C:\wxWidgets-3.1.2\build\msw/../../src/msw/filedlg.cpp:367: undefined reference to `CommDlgExtendedErr[email protected]'
collect2.exe: error: ld returned 1 exit status

11:43:37 Build Failed. 676 errors, 0 warnings. (took 13s.645ms)

PB
Part Of The Furniture
Part Of The Furniture
Posts: 1915
Joined: Sun Jan 03, 2010 5:45 pm

Re: Building minimal.cpp Sample on Eclipse - Several "undefined reference to ..."

Post by PB » Mon Jan 28, 2019 3:15 pm

I think you are missing some Windows libraries.

Here is the command line for the wxWidgets minimal sample
l:\Dev\Desktop\Lib\wxWidgets-GIT\samples\minimal>mingw32-make -f makefile.gcc
g++ -o gcc_mswud\minimal.exe gcc_mswud\minimal_sample_rc.o gcc_mswud\minimal_minimal.o -g -mthreads -L.\..\..\lib\gcc_lib -Wl,--subsystem,windows -mwindows -lwxmsw31ud_core -lwxbase31ud -lwxtiffd -lwxjpegd -lwxpngd -lwxzlibd -lwxregexud -lwxexpatd -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lwsock32 -lwininet -loleacc -luxthem
I would make sure that all those libraries are in the project's linker settings.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3163
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Building minimal.cpp Sample on Eclipse - Several "undefined reference to ..."

Post by ONEEYEMAN » Mon Jan 28, 2019 4:05 pm

Hi,
In addition:

- make sure they are in the proper order
- I'd also add "_UNICODE" to the defined symbols list.

Thank you.

User avatar
TukingFypo
In need of some credit
In need of some credit
Posts: 8
Joined: Tue Jan 22, 2019 1:16 pm

Re: Building minimal.cpp Sample on Eclipse - Several "undefined reference to ..."

Post by TukingFypo » Tue Jan 29, 2019 1:25 pm

Compiled fine. No errors.

Thank you *SO* much!!!!

Post Reply