News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

undefined reference to `WinMain@16' ??????

Started by fouzimedfouni, March 30, 2015, 07:12:43 AM

Previous topic - Next topic

fouzimedfouni

each time I compile i get that : main.c||undefined reference to `WinMain@16'|
whats the problem here ?
thank you

MortenMacFly

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: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

fouzimedfouni

- 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 ---------->



#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);
}



BlueHazzard

Quote from: fouzimedfouni on March 30, 2015, 08:19:23 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

gd_on

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 (25H2), svn C::B (last version or almost!), wxWidgets 3.3.2, Msys2 Compilers 16.1.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).