Code::Blocks

Developer forums (C::B DEVELOPMENT STRICTLY!) => Contributions to C::B => Topic started by: ivan_ijh on January 07, 2008, 05:04:56 am

Title: Undefined references when linking "devel\wxscintilla.dll"
Post by: ivan_ijh on January 07, 2008, 05:04:56 am
I have a problem linking wxscintilla.

Version: svn build rev 4767

My input (link) libraries are:
"wxmsw28$(WX_SUFFIX)" is actually  "libwxmsw28u.a" and "gdi32" are installed from "wxPack".

I'm using "GNU GCC Compiler" .

And here is a  Built Log:

Quote
-------------- Build: scintilla in Code::Blocks ---------------

Linking dynamic library: devel\wxscintilla.dll
.objs\sdk\wxscintilla\src\PlatWX.o: In function `ZN4Font6CreateEPKciibbb':
D:/cvs_projects/codeblocks/trunk/src/sdk/wxscintilla/src/PlatWX.cpp:109: undefined reference to `_imp___ZN19wxEncodingConverter22GetPlatformEquivalentsE14wxFontEncodingi'
.objs\sdk\wxscintilla\src\PlatWX.o: In function `ZN11SurfaceImpl10InitPixMapEiiP7SurfacePv':
D:/cvs_projects/codeblocks/trunk/src/sdk/wxscintilla/src/PlatWX.cpp:222: undefined reference to `_imp___ZN8wxBitmapC1Eiii'
.objs\sdk\wxscintilla\src\PlatWX.o: In function `ZN11SurfaceImpl7ReleaseEv':
D:/cvs_projects/codeblocks/trunk/src/sdk/wxscintilla/src/PlatWX.cpp:229: undefined reference to `_imp__wxNullBitmap'
.objs\sdk\wxscintilla\src\PlatWX.o: In function `ZN11SurfaceImpl9PenColourE15ColourAllocated':
D:/cvs_projects/codeblocks/trunk/src/sdk/wxscintilla/src/PlatWX.cpp:247: undefined reference to `_imp___ZN5wxPenC1ERK8wxColourii'
.objs\sdk\wxscintilla\src\PlatWX.o: In function `ZN11SurfaceImpl11BrushColourE15ColourAllocated':
D:/cvs_projects/codeblocks/trunk/src/sdk/wxscintilla/src/PlatWX.cpp:251: undefined reference to `_imp___ZN7wxBrushC1ERK8wxColouri'
.objs\sdk\wxscintilla\src\PlatWX.o: In function `ZN11SurfaceImpl13FillRectangleE10PRectangle15ColourAllocated':
D:/cvs_projects/codeblocks/trunk/src/sdk/wxscintilla/src/PlatWX.cpp:293: undefined reference to `_imp___ZN10wxStockGDI6GetPenENS_4ItemE'
.objs\sdk\wxscintilla\src\PlatWX.o: In function `ZN11SurfaceImpl13FillRectangleE10PRectangleR7Surface':
D:/cvs_projects/codeblocks/trunk/src/sdk/wxscintilla/src/PlatWX.cpp:298: undefined reference to `_imp___ZN7wxBrushC1Ev'
D:/cvs_projects/codeblocks/trunk/src/sdk/wxscintilla/src/PlatWX.cpp:300: undefined reference to `_imp___ZN7wxBrushC1ERK8wxBitmap'
D:/cvs_projects/codeblocks/trunk/src/sdk/wxscintilla/src/PlatWX.cpp:302: undefined reference to `_imp___ZN10wxStockGDI9GetColourENS_4ItemE'
D:/cvs_projects/codeblocks/trunk/src/sdk/wxscintilla/src/PlatWX.cpp:302: undefined reference to `_imp___ZN7wxBrushC1ERK8wxColouri'
..........................
(and much more..)


All these symbols exists in link libraries, but without "_imp_" prefix (added later by linker I suppose)


Title: Re: Undefined references when linking "devel\wxscintilla.dll"
Post by: stahta01 on January 07, 2008, 08:21:25 am
All these symbols exists in link libraries, but without "_imp_" prefix (added later by linker I suppose)

The compiler and linker are both involved in creating the "_imp_" prefix. But, I think of it mainly being the compiler; the dllexport and dllimport keywords are used in this.

Which version of wxWidgets are you using?
What steps did you follow to compile it?
Which wxPack file did you download?

I also need to know which version of MinGW is being used?

You can normally get this by running this command for MinGW GCC before version 4.0
The MinGW GCC 4.x versions requires a different command, sometimes.

Code: [Select]
gcc -v

Tim S

Title: Re: Undefined references when linking "devel\wxscintilla.dll"
Post by: ivan_ijh on January 07, 2008, 02:29:51 pm
Which version of wxWidgets are you using?
What steps did you follow to compile it?
Which wxPack file did you download?

I also need to know which version of MinGW is being used?

I tried with two packages of wxWidgets  with same result :
1) 2.8 - from "wxPack_v2.8.7.03.exe"
2) 2.8.7 from "wxWidgets-2.8.7.tar.gz" downloaded from wxWidgets site
and compiled with this miniGW :

Quote
gcc -v
Reading specs from D:/programming/MinGW/bin/../lib/gcc/mingw32/3.4.5/specs
Configured with: ../gcc-3.4.5/configure --with-gcc --with-gnu-ld --with-gnu-as -
-host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --
enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --disable-shar
ed --enable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x --ena
ble-java-gc=boehm --disable-libgcj-debug --enable-interpreter --enable-hash-sync
hronization --enable-libstdcxx-debug
Thread model: win32
gcc version 3.4.5 (mingw special)

in C::B  i'm using maybe :

Quote
gcc -v
Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as --host=
mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --enable
-languages=c,c++,f77,ada,objc,java --disable-win32-registry --disable-shared --e
nable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x --enable-ja
va-gc=boehm --disable-libgcj-debug --enable-interpreter --enable-hash-synchroniz
ation --enable-libstdcxx-debug
Thread model: win32
gcc version 3.4.4 (mingw special)

Well..wxPack as I know, it is not necessary to build anything.

Title: Re: Undefined references when linking "devel\wxscintilla.dll"
Post by: MortenMacFly on January 07, 2008, 02:45:05 pm
I have a problem linking wxscintilla.
Try moving the wxscintilla lib before and after the wx lib (I don't recall what's right - but only *one* way is correct). The order of libraries that depend on each other matters in the linker settings!
Title: Re: Undefined references when linking "devel\wxscintilla.dll"
Post by: stahta01 on January 07, 2008, 06:37:49 pm
gcc version 3.4.4 (mingw special)

Where did you get gcc version 3.4.4 (mingw special)?
Edit: Found it, RC2 had 3.4.4 with it.
I am downloading it now to test with wxPack.

I am still testing, but it appears to be an issue in the compiler gcc version 3.4.4 (mingw special) at first testing.

The wxPack works OK, so the issue is the compiler; please upgrade to 3.4.5 to use that wxPack.

Tim S
Title: Re: Undefined references when linking "devel\wxscintilla.dll"
Post by: ivan_ijh on January 09, 2008, 02:33:07 am
PROBLEM RESOLVED

 and C::B successfully built. I found that there is a two directories for library (object)  files :
"gcc_dll" and "gcc_lib" with same libraries inside. But the libraries in "gcc_dll" have names (symbols) with "_imp_" prefix and the libraries in "gcc_dll" doesn't have names with this prefix.

For example in  gcc_dll/libwxmsw28.a
__imp__wxTopLevelWindows
and in gcc_lib/libwxmsw28.a same symbol is
_wxTopLevelWindows

I just changed linker option directories from 
"$(#WX.lib)\gcc_lib$(WX_CFG)\msw$(WX_SUFFIX)" to
"$(#WX.lib)\gcc_dll$(WX_CFG)\msw$(WX_SUFFIX)" .

Yes...it was all MY FAULT, because I changed this option before - when I tried to guess the correct libraries directory. Thanks for help anyway. Sorry ! :cry: