Code::Blocks Forums

User forums => Help => Topic started by: fouzimedfouni on March 30, 2015, 07:12:43 am

Title: undefined reference to `WinMain@16' ??????
Post by: fouzimedfouni 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
Title: Re: undefined reference to `WinMain@16' ??????
Post by: MortenMacFly 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.
Title: Re: undefined reference to `WinMain@16' ??????
Post by: fouzimedfouni 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);
}

Title: Re: undefined reference to `WinMain@16' ??????
Post by: BlueHazzard 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
Title: Re: undefined reference to `WinMain@16' ??????
Post by: gd_on 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