Author Topic: undefined reference to `WinMain@16' ??????  (Read 6046 times)

Offline fouzimedfouni

  • Single posting newcomer
  • *
  • Posts: 2
undefined reference to `WinMain@16' ??????
« on: March 30, 2015, 07:12:43 am »
each time I compile i get that : main.c||undefined reference to `WinMain@16'|
whats the problem here ?
thank you

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: undefined reference to `WinMain@16' ??????
« Reply #1 on: March 30, 2015, 07:33:55 am »
Nobody will/can help you if you don't state at minimum:
- OS
- version of C::B and compiler
- steps to reproduce
- example code snippets
- full compiler log

Please keep that in mind for future posts. Thank you.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline fouzimedfouni

  • Single posting newcomer
  • *
  • Posts: 2
Re: undefined reference to `WinMain@16' ??????
« Reply #2 on: March 30, 2015, 08:19:23 am »
- OS  ------------------------------------>Win 7
- version of C::B and compiler -----> 13.12
- steps to reproduce ---------------->?
- full compiler log -------------------->main.c||undefined reference to `WinMain@16'|
                                                      ||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|

- example code snippets ---------->

Code

#include <stdio.h>
#include <string.h>

struct Books{
   char  title[50];
   char  author[50];
   char  subject[100];
   int   book_id;
};
typedef struct Books TTT;
print_book(TTT *book){
    printf(" here is your value of the function of the STRUCT :%i", book->book_id);

int main( )
{
    TTT *livre;
    TTT MNB;
    livre= &MNB;

    //livre->book_id = 123;
    print_book(livre);

}

 printhello(TTT *boo){
    printf("Enter your book # here please :");
    scanf("%i",&boo->book_id);
    printf("your boo book_id is : %i\n\n\n\n\n\n\n\n\n\n", boo->book_id);
}


Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: undefined reference to `WinMain@16' ??????
« Reply #3 on: March 30, 2015, 10:54:39 am »
- full compiler log -------------------->main.c||undefined reference to `WinMain@16'|
                                                      ||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|

This is not the full build log.
Hit rebuild: Build->Rebuild
and post the log from the Build Log tab

greetings

Offline gd_on

  • Lives here!
  • ****
  • Posts: 797
Re: undefined reference to `WinMain@16' ??????
« Reply #4 on: March 30, 2015, 07:52:39 pm »
More.
Your code seems to be a standard c console application, not a Windows 32 application. You have probably chosen the wrong template and it's why Winmain is asked.
Try first with the simple console application (simple hello program).

gd_on
Windows 11 64 bits (23H2), svn C::B (last version or almost!), wxWidgets 3.2.4 (tests with 3.3), Msys2 Compilers 13.2.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).