Unicode - Undifed reference to [email protected] Topic is solved

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
LsDevs
Knows some wx things
Knows some wx things
Posts: 31
Joined: Fri Feb 28, 2020 8:23 am

Unicode - Undifed reference to [email protected]

Post by LsDevs » Mon Mar 16, 2020 10:56 am

Hi everyone,

I'm compiling a x86 app and the project use Unicode.
I need to say I'm under Ubuntu and cross-compiling for windows so here are some infos :
- Build wxWidgets with i686-w64-mingw32-g++ and using unicode support.
- How I compile my program :

Code: Select all

i686-w64-mingw32-g++ *.cpp  $(wx-config-win_x86 --cxxflags --libs) -static -lgcc -lstdc++ -municode
The output of $(wx-config-win_x86 --cxxflags --libs) if you want to know :

Code: Select all

-I/home/ubuntu/Dev/C++/Libraries/wxWidgets/wxWidgets-3.1.3_x86/build_win/lib/wx/include/i686-w64-mingw32-msw-unicode-static-3.1 -I/home/ubuntu/Dev/C++/Libraries/wxWidgets/wxWidgets-3.1.3_x86/include -D_FILE_OFFSET_BITS=64 -DwxDEBUG_LEVEL=0 -D__WXMSW__ -mthreads
-L/home/ubuntu/Dev/C++/Libraries/wxWidgets/wxWidgets-3.1.3_x86/build_win/lib   -Wl,--subsystem,windows -mwindows /home/ubuntu/Dev/C++/Libraries/wxWidgets/wxWidgets-3.1.3_x86/build_win/lib/libwx_mswu_xrc-3.1-i686-w64-mingw32.a /home/ubuntu/Dev/C++/Libraries/wxWidgets/wxWidgets-3.1.3_x86/build_win/lib/libwx_mswu_qa-3.1-i686-w64-mingw32.a /home/ubuntu/Dev/C++/Libraries/wxWidgets/wxWidgets-3.1.3_x86/build_win/lib/libwx_baseu_net-3.1-i686-w64-mingw32.a /home/ubuntu/Dev/C++/Libraries/wxWidgets/wxWidgets-3.1.3_x86/build_win/lib/libwx_mswu_html-3.1-i686-w64-mingw32.a /home/ubuntu/Dev/C++/Libraries/wxWidgets/wxWidgets-3.1.3_x86/build_win/lib/libwx_mswu_core-3.1-i686-w64-mingw32.a /home/ubuntu/Dev/C++/Libraries/wxWidgets/wxWidgets-3.1.3_x86/build_win/lib/libwx_baseu_xml-3.1-i686-w64-mingw32.a /home/ubuntu/Dev/C++/Libraries/wxWidgets/wxWidgets-3.1.3_x86/build_win/lib/libwx_baseu-3.1-i686-w64-mingw32.a -lwxtiff-3.1-i686-w64-mingw32 -lwxjpeg-3.1-i686-w64-mingw32 -lwxpng-3.1-i686-w64-mingw32 -lwxregexu-3.1-i686-w64-mingw32 -lwxscintilla-3.1-i686-w64-mingw32 -lwxexpat-3.1-i686-w64-mingw32 -lwxzlib-3.1-i686-w64-mingw32 -lrpcrt4 -loleaut32 -lole32 -luuid -luxtheme -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lcomdlg32 -ladvapi32 -lversion -lwsock32 -lgdi32 -loleacc
And I always got an error when compiling :

Code: Select all

.cpp Dev/C++/Projets/Trainning/AssaultCube_Trainning/Proc/*.cpp $(wx-config-win_x86 --cxxflags --libs --unicode) -static -lgcc -lstdc++ -mwindows -municode
/usr/bin/i686-w64-mingw32-ld : /usr/lib/gcc/i686-w64-mingw32/9.2-win32/../../../../i686-w64-mingw32/lib/../lib/libmingw32.a(lib32_libmingw32_a-crt0_w.o) : dans la fonction « wmain » :
./build/i686-w64-mingw32-i686-w64-mingw32-crt/./mingw-w64-crt/crt/crt0_w.c:23 : référence indéfinie vers « [email protected] »
Here's how I wrote the program :

Code: Select all

class App : public wxApp {

    virtual bool OnInit() wxOVERRIDE;

};

wxDECLARE_APP(App);

Code: Select all

wxIMPLEMENT_APP(App);
bool App::OnInit() {

    MainFrame *test = new MainFrame("Assault");
    test->Show(true);

    return true;

};
And the MainFrame :

Code: Select all

enum {
    ID_BTN = 1
};


MainFrame::MainFrame(const wxString &title)
    : wxFrame(nullptr, wxID_ANY, title, wxDefaultPosition, wxSize(200,200)) {

    btn = new wxButton(this, ID_BTN, "1337");

    Connect(ID_BTN, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MainFrame::OnButtonClick));

}

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

Re: Unicode - Undifed reference to [email protected]

Post by ONEEYEMAN » Mon Mar 16, 2020 12:43 pm

Hi,
I guess by default cross-compiler is using "CONSOLE" application option.
Can you try to pass "-mwindows" as an option flag?

Thank you.

LsDevs
Knows some wx things
Knows some wx things
Posts: 31
Joined: Fri Feb 28, 2020 8:23 am

Re: Unicode - Undifed reference to [email protected]

Post by LsDevs » Mon Mar 16, 2020 1:06 pm

ONEEYEMAN wrote:
Mon Mar 16, 2020 12:43 pm
Hi,
I guess by default cross-compiler is using "CONSOLE" application option.
Can you try to pass "-mwindows" as an option flag?

Thank you.
Hi, thanks for helping.
I used this command with the -mwindows flag as you recommend

Code: Select all

i686-w64-mingw32-g++ *.cpp $(wx-config-win_x86 --cxxflags --libs --unicode) -static -lgcc -lstdc++ -municode -mwindows


Got the same error :

Code: Select all

/usr/bin/i686-w64-mingw32-ld : /usr/lib/gcc/i686-w64-mingw32/9.2-win32/../../../../i686-w64-mingw32/lib/../lib/libmingw32.a(lib32_libmingw32_a-crt0_w.o) : dans la fonction « wmain » :
./build/i686-w64-mingw32-i686-w64-mingw32-crt/./mingw-w64-crt/crt/crt0_w.c:23 : référence indéfinie vers « [email protected] »
collect2: error: ld returned 1 exit status
Could it be related to the way I compiled the library ?

EDIT :
For info I compiled the library like this :

Code: Select all

../configure --disable-debug_flag --disable-shared --host=i686-w64-mingw32 --build=x86_64-linux-gnu --enable-unicode --with-msw --with-sdl --prefix=/usr/i686-w64-mingw32

User avatar
doublemax
Moderator
Moderator
Posts: 14613
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Unicode - Undifed reference to [email protected]

Post by doublemax » Mon Mar 16, 2020 5:20 pm

Based on this post i found ( https://social.msdn.microsoft.com/Forum ... mentissues ), the symbol "[email protected]" is only available in 32 bit builds.

Are you trying to build a 32 or 64 bit app?
Use the source, Luke!

LsDevs
Knows some wx things
Knows some wx things
Posts: 31
Joined: Fri Feb 28, 2020 8:23 am

Re: Unicode - Undifed reference to [email protected]

Post by LsDevs » Mon Mar 16, 2020 7:32 pm

doublemax wrote:
Mon Mar 16, 2020 5:20 pm
Based on this post i found ( https://social.msdn.microsoft.com/Forum ... mentissues ), the symbol "[email protected]" is only available in 32 bit builds.

Are you trying to build a 32 or 64 bit app?
I try to build x86 version.
I solved it removing the -municode flags, it worls.

Post Reply