0

I'am trying to compile my code using a Makefile, but when I type make in the terminal this error occures:

" g++ -I/mingw64/include/ncurses -o GAME -lncurses -L/mingw64/bin -static c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../..\libmingw32.a(main.o):(.text.startup+0xa0): undefined reference to `WinMain@16' collect2.exe: error: ld returned 1 exit status make: *** [Makefile:36: GAME] Error 1 "

I am using the ncurses library for a project, I've already done the make file with another project and it worked, but now with this new project it gives error...

My main file:

#include <ncurses/ncurses.h>
#include <iostream>

int main(int argc, char ** argv){

initscr();
refresh();
noecho();
curs_set(0);`
WINDOW*board_win;
    int height=30, width=30, start_row, start_col;
    int xMax,yMax;
    getmaxyx(stdscr,yMax,xMax);
    start_row=(yMax/2)-(height/2);
    start_col= (xMax/2)-(width/2);
    board_win= newwin (height, width , start_row ,start_col);
    keypad(board_win,true);
    refresh();
    wprintw(board_win, 0,0,"ciao");

    
return 0;
}
  • The command line `g++ -I/mingw64/include/ncurses -o GAME -lncurses -L/mingw64/bin -static` suggests you're not linking the main file object. At least I'm not seeing any object file in there, only the ncurses lib (which of course has no main function). – Andreas Mar 10 '23 at 07:24

0 Answers0