Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: Pecan on October 22, 2005, 11:23:54 pm

Title: Help compiling example plugin
Post by: Pecan on October 22, 2005, 11:23:54 pm
I've tried two days to compile the example plugin generated
by the wizard. I've added no code to it, and tried following
the directions provided by the "Hello World" tutorials.
I've downloaded, and installed wxWidgets 2.6.1 (wx_msw-2.6).

The widget examples compile and run, and all my Dev-cpp projects import, compile, and execute beautifully. (win xp sp2).

However, when linking a plugin, the linker finds all sorts of duplicates
and missing references. What is causing this?

I'd appreciate any help given.
 Thanks, Pecan

[Directories/Compiler entries]
..\..\CodeBlocks\SDK\include
..\..\CodeBlocks\lib\wx\include\msw-ansi-release-static-2.6
..\..\CodeBlocks\include\wx-2.6

[Directories/Linker entries]
..\..\CodeBlocks\SDK\lib

[Compiler Options]
__GNUWIN32__
WXUSINGDLL
BUILDING_PLUGIN
__WXMSW__  <<I threw this in just to see if it had an effect. Answer: none

[Linker/Link Libraries entries]
codeblocks
wxmsw  <<this was my last try with the 2.4.2 lib

[have also tried wx_msw-2.6 and get same results]
[ as below]

[error window output]

Project   : Custom Plugin
Compiler  : GNU GCC Compiler (called directly)
Directory : C:\Usr\Proj\temp\
--------------------------------------------------------------------------------
Switching to target: default
Compiling: untitled1.cpp
Linking dynamic library: Untitled1.dll
..\..\CodeBlocks\SDK\lib/libwxmsw.a(event.o):event.cpp:(.text$_ZNK12wxEvtHandler12GetClassInfoEv[wxEvtHandler::GetClassInfo() const]+0x0): multiple definition of `wxEvtHandler::GetClassInfo() const'
..\..\CodeBlocks\SDK\lib/libcodeblocks.a(d003971.o):: first defined here
..\..\CodeBlocks\SDK\lib/libwxmsw.a(string.o):string.cpp:(.text+0x5a2): multiple definition of `wxString::operator=(char const*)'
.objs\untitled1.o:untitled1.cpp:(.text$_ZN8wxStringaSEPKc[wxString::operator=(char const*)]+0x0): first defined here
.objs\untitled1.o:untitled1.cpp:(.text$_ZN8wxStringaSEPKc[wxString::operator=(char const*)]+0x14): undefined reference to `_imp___ZN12wxStringBaseaSEPKc'
.objs\untitled1.o:untitled1.cpp:(.text$_ZN12wxStringBaseC2EPKc[wxStringBase::wxStringBase(char const*)]+0x7): undefined reference to `_imp___ZN12wxStringBase4nposE'
.objs\untitled1.o:untitled1.cpp:(.text$_ZN12wxStringBaseC2EPKc[wxStringBase::wxStringBase(char const*)]+0x27): undefined reference to `_imp___ZN12wxStringBase8InitWithEPKcjj'
.objs\untitled1.o:untitled1.cpp:(.rdata$_ZTV9Untitled1[vtable for Untitled1]+0x4c): undefined reference to `wxEvtHandler::TryParent(wxEvent&)'
.objs\untitled1.o:untitled1.cpp:(.rdata$_ZTV9Untitled1[vtable for Untitled1]+0x54): undefined reference to `wxEvtHandler::GetEventHashTable() const'
.objs\untitled1.o:untitled1.cpp:(.rdata$_ZTV12cbToolPlugin[vtable for cbToolPlugin]+0x4c): undefined reference to `wxEvtHandler::TryParent(wxEvent&)'
.objs\untitled1.o:untitled1.cpp:(.rdata$_ZTV12cbToolPlugin[vtable for cbToolPlugin]+0x54): undefined reference to `wxEvtHandler::GetEventHashTable() const'
..\..\CodeBlocks\SDK\lib/libwxmsw.a(app.o):app.cpp:(.text+0x413): undefined reference to `InitCommonControls@0'
..\..\CodeBlocks\SDK\lib/libwxmsw.a(app.o):app.cpp:(.text+0x41a): undefined reference to `OleInitialize@4'
..\..\CodeBlocks\SDK\lib/libwxmsw.a(app.o):app.cpp:(.text+0x477): undefined reference to `CreateBrushIndirect@4'
..\..\CodeBlocks\SDK\lib/libwxmsw.a(app.o):app.cpp:(.text+0x484): undefined reference to `DeleteObject@4'
..\..\CodeBlocks\SDK\lib/libwxmsw.a(app.o):app.cpp:(.text+0x8d1): undefined reference to `DeleteObject@4'
..\..\CodeBlocks\SDK\lib/libwxmsw.a(app.o):app.cpp:(.text+0x8d6): undefined reference to `OleUninitialize@0'
..\..\CodeBlocks\SDK\lib/libwxmsw.a(window.o):window.cpp:(.text+0x1758): undefined reference to `SelectObject@8'

Title: Re: Help compiling example plugin
Post by: mandrav on October 23, 2005, 12:06:53 am
You have probably missed that Code::Blocks (and therefore its plugins) need a wxWidgets DLL to link to, not a static library...
Title: Re: Help compiling example plugin
Post by: Pecan on October 23, 2005, 12:13:28 am
Ok, thanks. Are there any instructions for
making the wxWidgets.DLL somewhere?
Was it in the DevPak? Anyway, it got pass me.
Where can I get it.

Thanks,
Pecan
Title: Re: Help compiling example plugin
Post by: sethjackson on October 23, 2005, 12:26:42 am
Go here. :) I think this will help you.

http://wiki.codeblocks.org/index.php/Compiling_wxWidgets_2.6.1_to_develop_Code::Blocks_%28MSW%29
Title: Re: Help compiling example plugin
Post by: Pecan on October 23, 2005, 04:25:03 am
Thank you mandrav & sethjackson.

I followed the directions from
http://wiki.codeblocks.org/index.php/Compiling_wxWidgets_2.6.1_to_develop_Code::Blocks_%28MSW%29

All seemed to go well, creating DLLs wxmsw26_gcc_cb.dll and wxmsw26_stc_gcc_cb.dll which I moved to a dir on the search path.

..AND..the wizard generated plugin compiled, producing "untitled1.dll"
which I moved to ..\CodeBlocks\share\CodeBlocks\plugins\ .

Now, however, with the DLL in the plugins directory (win xp sp2)
C::B shows the splash screen, then crashes. Removing the plugin allows
C::B to run again.

What do I do now. I think I'm smelling something close to success!
What have I failed to do??

Another thought. Is it the case that a plugins wxWidgets version has to be the same
version as C::B's wxWidgets version??

I'm using wxWidgets 2.6.2 to make the plugin.

Thanks

Title: Re: Help compiling example plugin
Post by: rickg22 on October 23, 2005, 07:02:23 am
Some suggestions:

a) Try using wxwidgets 2.6.1 - there are some incompatibilities with 2.6.2 that we haven't managed to tackle yet.

b) Try using the CVS version of codeblocks. Or you can wait for the release of RC2 next week :)
Title: Re: Help compiling example plugin
Post by: Pecan on October 23, 2005, 08:01:45 am
Thanks for all the replies. They've really helped me get on my feet
with plugins.

I created a DLL with wxWidgets2.4.2 and all worked well. Ok, so it
took me 3 days. I'm getting old and slow.

So now, am I hearing (right) that I can use a wxWidgets2.6.1 DLL with
the current 1.0RC1.1 C::B to create plugins ??

Thanks


Title: Re: Help compiling example plugin
Post by: mandrav on October 23, 2005, 12:08:20 pm
Quote
Another thought. Is it the case that a plugins wxWidgets version has to be the same
version as C::B's wxWidgets version??

Correct.
Title: Re: Help compiling example plugin
Post by: sethjackson on October 23, 2005, 06:21:13 pm
FYI you don't need wxmsw26_stc_gcc_cb.dll. C::B uses wxScintilla (somebody correct me if I'm wrong).