Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Building wxWidgets undefined references
Building wxWidgets undefined references [message #229873] Mon, 02 February 2009 16:11 Go to next message
Eclipse UserFriend
Originally posted by: jamescobban.sympatico.ca

I cannot figure out what options to set in the Eclipse CDT so I can
build an executable for a wxWidgets project. Following the Eclipse
integration wiki I copied all of the flags from the command line make
but I get the following when I try to build the project:

**** Build of configuration Debug for project Ged2Html ****

make all
Building target: Ged2Html.exe
Invoking: GCC C++ Linker
g++ -L/c/wxWidgets-2.8.9/build-debug/lib -mwindows -lrpcrt4 -loleaut32
-lole32 -luuid -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32
-lctl3d32 -ladvapi32 -lwsock32 -lgdi32 -lwx_mswd_core-2.8 -lwx_based-2.8
-lwxtiffd-2.8 -lwxjpegd-2.8 -lwxpngd-2.8 -lwxzlibd-2.8 -lwxregexd-2.8
-lwxexpatd-2.8 -mthreads -lrpcrt4 -loleaut32 -lole32 -luuid -lwinspool
-lwinmm -lshell32 -lcomctl32 -lcomdlg32 -lctl3d32 -ladvapi32 -lwsock32
-lgdi32 -o"Ged2Html.exe" ./Address.o ./Attribute.o ./CharNoCase.o
../Child.o ./Date.o ./DateParser.o ./Debug.o ./Dupbuf.o ./Event.o
../Family.o ./File.o ./Ged2Html.o ./Header.o ./Individ.o
../IndividPointer.o ./MainWindow.o ./MultimediaRec.o ./NoSubtags.o
../Note.o ./NoteRec.o ./PersName.o ./Place.o ./RepositoryCitation.o
../RepositoryRec.o ./Root.o ./SourceCit.o ./SourceCitData.o ./SourceRec.o
../String.o ./SubmissionRec.o ./SubmitterRec.o ./Syntax.o ./Tag.o
../Text.o ./Unexpected.o ./printable.o
../Ged2Html.o: In function `WinMain@16':
C:\Documents and Settings\Jim Cobban\My Documents\My
Programs\EclipseWorkspace\Ged2Html\Debug/../Ged2Html.cpp:30: undefined
reference to `wxEntry(HINSTANCE__*, HINSTANCE__*, char*, int)'
../Ged2Html.o: In function `Z11wxCreateAppv':
C:\Documents and Settings\Jim Cobban\My Documents\My
Programs\EclipseWorkspace\Ged2Html\Debug/../Ged2Html.cpp:30: undefined
reference to `wxAppConsole::CheckBuildOptions(char const*, char const*)'
../Ged2Html.o:C:/wxWidgets-2.8.9/include/wx/app.h:279: undefined
reference to `wxAppConsole::ms_appInitFn'
../Ged2Html.o:C:/wxWidgets-2.8.9/include/wx/app.h:287: undefined
reference to `wxAppConsole::ms_appInstance'
../Ged2Html.o: In function `~wxThreadHelperThread':
C:/wxWidgets-2.8.9/include/wx/thread.h:594: undefined reference to
`wxThread::~wxThread()'
C:/wxWidgets-2.8.9/include/wx/thread.h:594: undefined reference to
`wxThread::~wxThread()'
../Ged2Html.o: In function `~GenApp':
C:\Documents and Settings\Jim Cobban\My Documents\My
Programs\EclipseWorkspace\Ged2Html\Debug/../GenApp.h:13: undefined
reference to `wxApp::~wxApp()'
C:\Documents and Settings\Jim Cobban\My Documents\My
Programs\EclipseWorkspace\Ged2Html\Debug/../GenApp.h:13: undefined
reference to `wxApp::~wxApp()'
../Ged2Html.o: In function `wxStringBase':
C:/wxWidgets-2.8.9/include/wx/string.h:368: undefined reference to
`wxStringBase::npos'
C:/wxWidgets-2.8.9/include/wx/string.h:368: undefined reference to
`wxStringBase::InitWith(char const*, unsigned int, unsigned int)'
../Ged2Html.o: In function `GenApp':
C:\Documents and Settings\Jim Cobban\My Documents\My
Programs\EclipseWorkspace\Ged2Html\Debug/../GenApp.h:13: undefined
reference to `wxApp::wxApp()'
../Ged2Html.o:Ged2Html.cpp:(.rdata$_ZTV6GenApp[vtable for GenApp]+0x8):
undefined reference to `wxApp::GetClassInfo() const'
../Ged2Html.o:Ged2Html.cpp:(.rdata$_ZTV6GenApp[vtable for GenApp]+0x14):
undefined reference to `wxObject::CreateRefData() const'
Re: Building wxWidgets undefined references [message #229885 is a reply to message #229873] Mon, 02 February 2009 17:29 Go to previous messageGo to next message
Dmitry Smirnov is currently offline Dmitry SmirnovFriend
Messages: 92
Registered: July 2009
Member
James Cobban wrote:

> I cannot figure out what options to set in the Eclipse CDT so I can
> build an executable for a wxWidgets project.

Have you tried to build your project from console? Is there any difference
in command line for your .exe?

I can suggest the following
1. None of the symbols is not found in the list of the wx libraries you
had specified. So check the list of libs. Also check the order (not sure
this is applicable for GCC but for others this could be important)
2. Your C++ code is not compiled properly. Typically this happens if you
do not use extern "C" or some windows-specific modifiers like APIENTRY for
function definition/declaration. So, linker in fact tries to resolve
mangled name instead of non-mangled...

Dmitry
Re: Building wxWidgets undefined references [message #229892 is a reply to message #229885] Mon, 02 February 2009 22:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jamescobban.sympatico.ca

Dmitry Smirnov wrote:
> James Cobban wrote:
>
>> I cannot figure out what options to set in the Eclipse CDT so I can
>> build an executable for a wxWidgets project.
>
> Have you tried to build your project from console? Is there any
> difference in command line for your .exe?

I get the same output from the command line, but that is what I would
expect because Eclipse created the makefile.
>
> I can suggest the following
> 1. None of the symbols is not found in the list of the wx libraries you
> had specified. So check the list of libs. Also check the order (not sure
> this is applicable for GCC but for others this could be important)

The problem is that I don't have the foggiest notion what the parameters
are supposed to be. The Wiki on how to use WxWidgets from Eclipse
simply says "copy the parameters", so that is what I did. But I don't
know why those are the parameters on the wxWidgets sample makefile, so I
don't know how to modify them for my application.

> 2. Your C++ code is not compiled properly. Typically this happens if you
> do not use extern "C" or some windows-specific modifiers like APIENTRY
> for function definition/declaration. So, linker in fact tries to resolve
> mangled name instead of non-mangled...

If the wxWidgets code is compiling incorrectly I have no idea how to
change it. I am not declaring anything, so if there is something wrong
with the wxWidgets header files I have no idea how to "correct" it. I
am just copying code from the samples, since I do not yet understand
wxWidgets well enough to be able to create my own code.

I see from other threads that lots of people are compiling wxWidgets
under Eclipse, but I have no idea how they are accomplishing that.
Re: Building wxWidgets undefined references [message #229901 is a reply to message #229873] Tue, 03 February 2009 07:29 Go to previous messageGo to next message
Heiko Lechner is currently offline Heiko LechnerFriend
Messages: 10
Registered: July 2009
Junior Member
James Cobban schrieb:
> I cannot figure out what options to set in the Eclipse CDT so I can
> build an executable for a wxWidgets project.

Have you tried this:
http://wiki.wxwidgets.org/Eclipse%2C_CDT_%26_MingW_%26_MSYS_ Setup_Guide

?
Re: Building wxWidgets undefined references [message #229945 is a reply to message #229901] Wed, 04 February 2009 04:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jamescobban.sympatico.ca

Heiko Lechner wrote:
> James Cobban schrieb:
>> I cannot figure out what options to set in the Eclipse CDT so I can
>> build an executable for a wxWidgets project.
>
> Have you tried this:
> http://wiki.wxwidgets.org/Eclipse%2C_CDT_%26_MingW_%26_MSYS_ Setup_Guide
>
> ?
Thank you for the pointer.

I followed these instructions as closely as I could considering that I
already have wxWidgets installed according to the procedure described in
C:\wxWidgets-2.8.9\docs\msw\install.txt, which is not the procedure
described in the referenced wiki.

Before I even try the build the CDT editor complains of a syntax error on:

DECLARE_EVENT_TABLE()

and everything from:

BEGIN_EVENT_TABLE(MyFrame, wxFrame)

to the end of the OnInit method.
Plus the wxMessageBox call in MyFrame::OnAbout.

When I request the project build I get the following output.

**** Rebuild of configuration Debug for project sampleMinimum ****

**** Internal Builder is used for build ****
g++ `wx-config --static=no --cxxflags`
-IC:\msys\1.0\local\include\wx-2.8 -O0 -g3 -Wall -c -fmessage-length=0
-osrc\minimal.o ..\src\minimal.cpp
cc1plus.exe: error: unrecognized command line option "-fcxxflags`"
g++: extraneous argument to '--static' option
g++: `wx-config: No such file or directory
Build error occurred, build is stopped
Time consumed: 359 ms.

I do not understand what I am doing, because I am blindly following the
advice in the various wikis and guides, without understanding why I am
being asked to issue the various incantations. As a result I have no
knowledge upon which to intelligently adjust the actions that I am taking.

For example at one point in the instructions I am asked to issue the
incantation:

mv /mingw/lib/wx*.dll /mingw/bin/

However there are no wx*.dll files in /mingw/lib. Indeed I cannot find
any wx*.dll files anywhere on my system. In any event make install did
not copy anything into the /mingw directory hierarchy. It put
everything under /usr/local in the msys directory.

I have clearly done something wrong, but I am mystified as to how to
determine what.
Re: Building wxWidgets undefined references [message #229960 is a reply to message #229945] Wed, 04 February 2009 08:31 Go to previous messageGo to next message
Heiko Lechner is currently offline Heiko LechnerFriend
Messages: 10
Registered: July 2009
Junior Member
James Cobban schrieb:

> I followed these instructions as closely as I could considering that I
> already have wxWidgets installed according to the procedure described in
> C:\wxWidgets-2.8.9\docs\msw\install.txt, which is not the procedure
> described in the referenced wiki.

Ok, change that ;)

> I do not understand what I am doing, because I am blindly following the
> advice in the various wikis and guides, without understanding why I am
> being asked to issue the various incantations. As a result I have no
> knowledge upon which to intelligently adjust the actions that I am taking.

But you are willing to learn.

> For example at one point in the instructions I am asked to issue the
> incantation:
>
> mv /mingw/lib/wx*.dll /mingw/bin/
>
> However there are no wx*.dll files in /mingw/lib.

So it seems that you compiled wxWidgets static.

> I have clearly done something wrong, but I am mystified as to how to
> determine what.

Hmm...

First you need the MinGW and MSYS /bin directories in the path
environment variable.

And you must tell MSYS where your MinGW installation resides.

To "Building and configuring wxWidgets"

"./configure --prefix=/mingw --enable-shared"

with this line a makefile is created, which will copy all builded files
to /mingw/bin, /mingw/lib etc. after "make install". If you change to
"--prefix=/xyz" make install will copy all files to /xyz/bin, /xyz/lib
etc.. "--enable-shared" will configure the makefile to build shared
libraries (in windows: *.dll).

This step: "mv /mingw/lib/wx*.dll /mingw/bin/"
is a quick trick ;)

If you compile a program which uses "wxwidgets shared" then you need the
necessary .dlls- so you could copy them in the path where your compiled
program will be started or you can put the .dll- directory also in your
windows path environment variable. Here the .dlls are moved to a
location which is already mentioned in the windows path environment
variable.

What should be mentioned- the makefile also prepares a script named
"wx-config", which can set up all necessary include dirs etc. (this is
clearly dependent on your --prefix option!)- this script is very
comfortable and should be used.

In eclipse the line:
"g++ `wx-config --static=no --cxxflags`"

starts the wx-config script within g++ (therefore the backticks are
used- and it _must_ be done with backticks) -> that cannot be done by
the windows shell, so you need MSYS. To tell eclipse that it has to use
MSYS you have to use the "Linux toolchain".

If you get linking errors then check all configuration lines in eclipse
that contain these backticks (eclipse is sometimes oblivious) also
check if the order of the linker command line pattern (${COMMAND}
${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS} ${FLAGS}) is right.

You should really use the mentioned guide step by step and then ask again!

HTH,
Heiko
Re: Building wxWidgets undefined references [message #230019 is a reply to message #229960] Thu, 05 February 2009 03:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jamescobban.sympatico.ca

Heiko Lechner wrote:
> James Cobban schrieb:
>

>
> You should really use the mentioned guide step by step and then ask again!
>
Thank you for your patience.

I have tried going back and rebuilding wxWidgets from scratch into the
recommended target and the build fails:

/c/MinGW/wxWidgets-2.8.9/bk-deps g++ -c -o richtextdll_richtextbuffer.o
-I.pch/wxprec_richtextdll -D__WXMSW__ -I./src/tiff -I./src/jpeg
-I./src/png -I./src/zlib -I./src/regex -I./src/expat/lib -DWXUSINGDLL
-DWXMAKINGDLL_RICHTEXT
-I/c/MinGW/wxWidgets-2.8.9/lib/wx/include/msw-ansi-release-2 .8
-I./include -DWX_PRECOMP -mthreads -Wall -Wundef -Wno-ctor-dtor-privacy
-O2 -fno-strict-aliasing ./src/richtext/richtextbuffer.cpp
0 [main] sh 5924 open_stackdumpfile: Dumping stack trace to
sh.exe.stackdump
0 [main] sh 5688 open_stackdumpfile: Dumping stack trace to
sh.exe.stackdump


sh.exe.stackdump contains:

MSYS-1.0.10 Build:2004-03-15 07:17
Exception: STATUS_ACCESS_VIOLATION at eip=71070C43
eax=7FFDF000 ebx=00000000 ecx=00000000 edx=0022F2B8 esi=00000000
edi=0022F0D8
ebp=0022EC7C esp=0022EC58 program=C:\msys\1.0\bin\sh.exe
cs=001B ds=0023 es=0023 fs=003B gs=0000 ss=0023
Stack trace:
Frame Function Args
0022EC7C 71070C43 (00000000, 0000001C, 000006DC, 00000000)
0022F138 7102AC7D (0022F2B8, 0022F2BC, 0022F2C0, 0022F160)
0022F2C8 7102B532 (0A0185C8, FFFFFFFF, 0A014E2E, 0040D5FC)
0022F2F8 0041BDFE (0A0150F8, 00000000, 0022F378, 004114C5)
0022F378 004114D5 (0A0185C8, FFFFFFFF, 00000004, 00000000)
0022F3D8 0040E9C6 (0A0185B0, 00000000, FFFFFFFF, 00000004)
0022F438 0040F8B8 (0A0186E0, 00000000, FFFFFFFF, FFFFFFFF)
0022F488 0040FBC4 (0A0186E0, 00000000, FFFFFFFF, FFFFFFFF)
0022F4E8 0040EBE2 (0A0186E0, 00000000, FFFFFFFF, FFFFFFFF)
0022F538 004499BB (0A018250, 00422DC6, 00000004, 00000000)
0022F594 0042313C (0A018250, 00000000, 0022F734, 00426AFD)
0022F734 00426FDD (0022F77C, 00000000, 00000000, 00000000)
0022F784 00428D6A (0A018338, 00000000, 00000000, 0022F7F4)
0022F7B4 00421631 (0A018338, 00000000, 00428D24, 0040D511)
0022F7F4 0042112E (0A0182C8, 00000001, 0022F854, 004489EA)
0022F834 004286C3 (0A015F28, 0000001F, 0A015E98, 0042C063)
End of stack trace (more stack frames may be present)
Re: Building wxWidgets undefined references [message #230026 is a reply to message #230019] Thu, 05 February 2009 07:45 Go to previous messageGo to next message
Heiko Lechner is currently offline Heiko LechnerFriend
Messages: 10
Registered: July 2009
Junior Member
James Cobban schrieb:

> sh.exe.stackdump contains: [...]

Sorry- I can't help you here :(

Have you unpacked Bash for MSYS?

Maybe you can get more help here: http://wxforum.shadonet.com/

HTH, Heiko.
Re: Building wxWidgets undefined references [message #230065 is a reply to message #229960] Thu, 05 February 2009 17:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jamescobban.sympatico.ca

Heiko Lechner wrote:
> James Cobban schrieb:
>
>>
>> mv /mingw/lib/wx*.dll /mingw/bin/
>>
>> However there are no wx*.dll files in /mingw/lib.
>
> So it seems that you compiled wxWidgets static.

I believe I have identified a problem in the wiki
http://wiki.wxwidgets.org/Eclipse%2C_CDT_%26_MingW_%26_MSYS_ Setup_Guide

""""""""quote"""""""""""
* move the contained folder wxWidgets-2.8.7 to "C:\MinGW" (so that
it becomes C:\MinGW\wxWidgets-2.8.7)
* execute "C:\msys\1.0\msys.bat" (or use the MSYS shortcut on your
desktop)

In the command prompt window that opens

* type (& confirm each line with Enter)

cd /mingw/wxWidgets-2.8.7
../configure --prefix=/mingw --enable-shared

""""""""""end quote"""""""""""""

The problem that I observe is that C:\MinGW\wxWidgets-2.8.9 (under
Windows) and /MinGW/wxWidgets-2.8.9 (under msys) are not the same
directory! Consistently using the Windows filesystem terminology they are:

C:\MinGW\wxWidgets-2.8.9 and C:\msys\1.0\MinGW\wxWidgets-2.8.9

As a result the either cd command fails, and if you change that command to:
cd /c/MinGW/wxWidgets-2.8.9
then you also have to change the configure command to:
../configure -- prefix=/c/MinGW --enable-shared

or alternatively change everything to use C:\msys\1.0\MinGW aka /MinGW.

Doing only half of the shift results in the "make install" command
scattering the product across the two directory structures.
Re: Building wxWidgets undefined references [message #230139 is a reply to message #230065] Fri, 06 February 2009 07:42 Go to previous message
Heiko Lechner is currently offline Heiko LechnerFriend
Messages: 10
Registered: July 2009
Junior Member
James Cobban schrieb:

> I believe I have identified a problem in the wiki
> http://wiki.wxwidgets.org/Eclipse%2C_CDT_%26_MingW_%26_MSYS_ Setup_Guide
>
> """"""""quote"""""""""""
> * move the contained folder wxWidgets-2.8.7 to "C:\MinGW" (so that
> it becomes C:\MinGW\wxWidgets-2.8.7)
> * execute "C:\msys\1.0\msys.bat" (or use the MSYS shortcut on your
> desktop)
>
> In the command prompt window that opens
>
> * type (& confirm each line with Enter)
>
> cd /mingw/wxWidgets-2.8.7
> ./configure --prefix=/mingw --enable-shared
>
> """"""""""end quote"""""""""""""
>
> The problem that I observe is that C:\MinGW\wxWidgets-2.8.9 (under
> Windows) and /MinGW/wxWidgets-2.8.9 (under msys) are not the same
> directory! Consistently using the Windows filesystem terminology they are:
>
> C:\MinGW\wxWidgets-2.8.9 and C:\msys\1.0\MinGW\wxWidgets-2.8.9

MSYS "mounts" the original MinGW directory to "/mingw".
So if you have installed MinGW to C:\XYZ\ABC\MinGW and told MSYS where
you installed MinGW then it will be "/mingw" (under MSYS) anyway.

> As a result the either cd command fails, and if you change that command to:
> cd /c/MinGW/wxWidgets-2.8.9
> then you also have to change the configure command to:
> ./configure -- prefix=/c/MinGW --enable-shared

If "cd /mingw/bin" fails under MSYS or there are no files in it then you
made a mistake "installing" MSYS- rerun "\MSYS\postinstall\pi.bat" under
windows.

HTH,
Heiko.
Previous Topic:Visual C Error Parser
Next Topic:Eclipse CDT remote Debugging Problem
Goto Forum:
  


Current Time: Fri Apr 26 05:09:52 GMT 2024

Powered by FUDForum. Page generated in 0.03643 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top