error: : undefined reference to `main'

294 views
Skip to first unread message

Daniel Pomrehn

unread,
Nov 9, 2005, 10:00:50 AM11/9/05
to wx-u...@lists.wxwindows.org
Hello,

I've written an wxWidgets application which uses SDL, too, on Windows and I
tried to compile it under Gentoo Linux. But the following link error occurs:

/usr/lib/gcc-lib/i386-pc-linux-gnu/3.3.6/../../../crt1.o(.text+0x18): In
function `_start':
: undefined reference to `main'

I have nothing like int main( int argc, char** argv) written, because
wxWidgets provides a main function, doesn't it?

I'm using Kdevelop. The output is this:
cd '/home/daniel/baeraergerdichnicht/debug' && WANT_AUTOCONF_2_5="1"
WANT_AUTOMAKE_1_6="1" gmake -k
gmake all-recursive
Making all in src
compiling cMainFrame.cpp (g++)
linking baeraergerdichnicht (libtool)
linking baeraergerdichnicht (g++)
/usr/lib/gcc-lib/i386-pc-linux-gnu/3.3.6/../../../crt1.o(.text+0x18): In
function `_start':
: undefined reference to `main'
collect2: ld returned 1 exit status
gmake[2]: *** [baeraergerdichnicht] Error 1
gmake[2]: Target `all' not remade because of errors.
gmake[1]: *** [all-recursive] Error 1
gmake: *** [all] Error 2
*** Exited with status: 2 ***


Can someone tell me, what I'm doing wrong?

Thanks in advance
Daniel

Werner Smekal

unread,
Nov 9, 2005, 9:53:25 AM11/9/05
to wx-u...@lists.wxwidgets.org
Hi,

take a close look at the minimal app in the samples directory. After you
have defined your app class (e.g. class MyApp : public wxApp {}) you
need to implement it with "IMPLEMENT_APP(MyApp)". This will create the
actual object and also an entry point main/WinMain.

HTH,
Werner

PS: Interesting program ("Baer Aerger dich nicht") this must be :)

> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-u...@lists.wxwidgets.org
> For additional commands, e-mail: wx-use...@lists.wxwidgets.org
>
>


John Ratliff

unread,
Nov 9, 2005, 10:12:39 AM11/9/05
to wx-u...@lists.wxwidgets.org

Daniel Pomrehn wrote:
> Hello,
>
> I've written an wxWidgets application which uses SDL, too, on Windows and I
> tried to compile it under Gentoo Linux. But the following link error occurs:
>
>
> Can someone tell me, what I'm doing wrong?

Have you seen this? http://code.technoplaza.net/wx-sdl/

--John Ratliff

Daniel Pomrehn

unread,
Nov 9, 2005, 4:08:38 PM11/9/05
to wx-u...@lists.wxwidgets.org
Hello,

thank's for your answers, I've found my mistake. I'd copied the souces,
createt under Windows to a kdevelop Project but forget the "main file" with
the IMPLEMEN_APP() in it, and didn't recognize this earlier.

But now I've got another error, when I try to execute the compiled program:
(process:26495): Gdk-WARNING **: locale not supported by C library

(baeraergerdichnicht:26495): Gtk-WARNING **: Locale not supported by C
library.
Using the fallback 'C' locale.

(baeraergerdichnicht:26495): Gtk-CRITICAL **:
gtk_label_set_text_with_mnemonic:
assertion 'str != NULL' failed
Fatal signal: Segmention Fault (SDL Parachute Deployed)


But this looks like an error in my system, nothing to do with wxWidgets.

Thanks :)
Daniel

Reply all
Reply to author
Forward
0 new messages