News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Cross Linking of a Linux Project in Windows

Started by apaeffgen, October 12, 2008, 08:28:52 PM

Previous topic - Next topic

apaeffgen

Hi all,
i am new to Codeblocks /wxWidgets. So maybe the problem is trivial.

On a samba share i have set up a linux CodeBlocks project on Centos, tested some gui-features and build the project for Linux. No Problems so far.

When i open the same project with codeblocks on Windows i get some linker errors.
I use Codeblocks with the mingw included, wxpack and the same project-settings as in the windows example project, that builds without errors.

The build-errors in the error log:
auto-import)

Info: resolving wxAppConsole::ms_appInitFn        by linking to __imp___ZN12wxAppConsole12ms_appInitFnE (auto-import)

C:\Programme\CodeBlocks\MinGW\bin\ld.exe: warning: auto-importing has been activated without --enable-auto-import specified on the command line.

This should work unless it involves constant data structures referencing symbols from auto-imported DLLs.obj\Debug\Windows2Main.o: In function `_ZNK12wxWindowBase10GetMinSizeEv':

C:/wxWidgetsPack/include/wx/window.h:(.text$_ZN12wxStringBase10ConcatSelfEjPKc[wxStringBase::ConcatSelf(unsigned int, char const*)]+0x22): undefined reference to `wxStringBase::ConcatSelf(unsigned int, char const*, unsigned int)'

C:/wxWidgetsPack/include/wx/window.h:(.text$_ZN12wxStringBaseC2EPKc[wxStringBase::wxStringBase(char const*)]+0x25): undefined reference to `wxStringBase::InitWith(char const*, unsigned int, unsigned int)'

C:/wxWidgetsPack/include/wx/window.h:(.text$_ZN12wxStringBaseC2ERKS_[wxStringBase::wxStringBase(wxStringBase const&)]+0x47): undefined reference to `wxOnAssert(char const*, int, char const*, char const*, char const*)'

obj\Debug\Windows2App.o: In function `_ZN12wxEvtHandler12TryValidatorER7wxEvent':

C:/wxWidgetsPack/include/wx/app.h:(.rdata$_ZTV11Windows2App[vtable for Windows2App]+0x44): undefined reference to `wxApp::Initialize(int&, char**)'

C:/wxWidgetsPack/include/wx/app.h:(.rdata$_ZTV11Windows2App[vtable for Windows2App]+0x90): undefined reference to `wxAppConsole::OnAssertFailure(char const*, int, char const*, char const*, char const*)'

C:/wxWidgetsPack/include/wx/app.h:(.rdata$_ZTV11Windows2App[vtable for Windows2App]+0x94): undefined reference to `wxAppConsole::OnAssert(char const*, int, char const*, char const*)'

collect2: ld returned 1 exit status

Only the linker has some problems.

The System Specs:
WinXP Home SP3
Codeblocks 8.02 with bundled mingw
wxpack for wxWidgets 2.8.8
On Linux Codeblocks 8.02
wxWidgets 2.8.8

P.S. if i forgot relevant info, please excuse me as a newbie.

Thanks in advance for the help
Andreas

TDragon

Are you trying to link object files compiled without wxUNICODE #defined with a Unicode build of wxWidgets?
[url="https://jmeubank.github.io/tdm-gcc/"]https://jmeubank.github.io/tdm-gcc/[/url] - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

apaeffgen

Hi TDragon,
i forgot that. Sorry.
The log now says:
Info: resolving vtable for wxwxMenuItemListNodeby linking to __imp___ZTV20wxwxMenuItemListNode (auto-import)
Info: resolving wxAppConsole::ms_appInstance        by linking to __imp___ZN12wxAppConsole14ms_appInstanceE (auto-import)
Info: resolving wxAppConsole::ms_appInitFn        by linking to __imp___ZN12wxAppConsole12ms_appInitFnE (auto-import)
C:\Programme\CodeBlocks\MinGW\bin\ld.exe: warning: auto-importing has been activated without --enable-auto-import specified on the command line.
This should work unless it involves constant data structures referencing symbols from auto-imported DLLs.obj\Debug\Windows2Main.o: In function `_ZNK12wxWindowBase10GetMaxSizeEv':
C:/wxWidgetsPack/include/wx/window.h:(.text$_ZN12wxStringBase10ConcatSelfEjPKc[wxStringBase::ConcatSelf(unsigned int, char const*)]+0x22): undefined reference to `wxStringBase::ConcatSelf(unsigned int, char const*, unsigned int)'
C:/wxWidgetsPack/include/wx/window.h:(.text$_ZN12wxStringBaseC2EPKc[wxStringBase::wxStringBase(char const*)]+0x25): undefined reference to `wxStringBase::InitWith(char const*, unsigned int, unsigned int)'
obj\Debug\Windows2App.o: In function `_ZN12wxEvtHandler12TryValidatorER7wxEvent':
C:/wxWidgetsPack/include/wx/app.h:(.rdata$_ZTV11Windows2App[vtable for Windows2App]+0x44): undefined reference to `wxApp::Initialize(int&, char**)'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 11 seconds)
3 errors, 1 warnings

Any other hints?
And thanks for the usefull tipp.
Best regards
Andreas

TDragon

Actually, I should've said "wxUSE_UNICODE" (note the USE_).
[url="https://jmeubank.github.io/tdm-gcc/"]https://jmeubank.github.io/tdm-gcc/[/url] - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Jenna

Did you clean the project tree before compiling, or do you use another target for building on win ?

I don't know what happens if you try to link object-files built on linux with the MinGW linker

apaeffgen

@TDragon:
Thanks, the project is now building.
@Jens:
I use the same target, but cleaned up the project.

The app crashes with an error "....could not be initialized (0xc0000005)....."
I will set up a separate target and try to build it again.

Thanks for the help.
Best regards
Andreas

apaeffgen

I found the cause of the crashing app.

Even though the app build on windows, the complete project settings were wrong.

At the moment i edited the project-file by hand, setting up targets for the different platforms. The automated project wizard-script puts general compiler, linker... settings not in the target section but below.

I moved and merged all the abstract compiler, linker... settings to special target sections and now the project builds on linux + windows without changing anything.

I set up a user template to reflect the basic settings.
Maybe it would be great to build a cross-platform wxwidgets wizard to simplify building a rudimentary app on every platform (Instead of Debug / Release maybe Platform -> Debug / Release?)

I did not find anything about this topic in the wiki, so maybe it should be added? Maybe as a basic How-To?

Best regards
Andreas

ChiPnGo

Hi all, I have the same problem:

Quote from: apaeffgen on October 12, 2008, 10:25:21 PM
...

The app crashes with an error "....could not be initialized (0xc0000005)....."

...

What was the solution?

stahta01

Quote from: ChiPnGo on December 18, 2008, 06:55:59 PM
Hi all, I have the same problem:

Quote from: apaeffgen on October 12, 2008, 10:25:21 PM
...

The app crashes with an error "....could not be initialized (0xc0000005)....."

...

What was the solution?

I traced my last cause of this problem to an wrong strip.exe being in the system path before the right one.
http://forums.next.codeblocks.org/index.php/topic,8675.0.html
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]