1 Reply Latest reply: Feb 15, 2009 11:15 PM by RayNewbie
osama_abdelfattah Level 1 (0 points)
im trying to migrate my project from windows to mac , when i use xcode to compile my code , i get the following error

Undefined symbols:
"_main", referenced from:
start in crt1.10.5.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

please help

apple, Mac OS X (10.5.6)
  • RayNewbie Level 5 (6,810 points)
    The short answer to your question is that the entry point to a Windows app is named 'WinMain', while the entry point to an OS X app is named 'main'. The linker message you reported just means that no main function was found, which is to be expected.

    Of course you can't simply change the name of WinMain to main, since everything from the parameters to the API calls are going to be entirely different. If your Windows app is built on one of the libraries intended for an OS X port, a lot of the problems may be solved for you. Otherwise I think it's safe to say that the changes to WinMain are going to be the very least of your challenges.
    Have you decided on whether to port to Carbon or Cocao? The choice might depend on whether your Windows program is written in "C" with direct calls to the Win32 API or written in C++ using MFC. I wish I could be of more help, but I've never moved a Windows program to OS X without a complete re-write.

    All the very best of luck!!