Cross compiling pdcurses from arch linux to windows

1k Views Asked by At

I'm trying to cross-compile a simple "Hello World!" program, from arch linux to windows

Here's the code:

#include <stdio.h>
#include <curses.h>

int main() {
    initscr();

    printw("Hello World!");
    refresh();
    getch();

    endwin();
    return 0;
}

And then I compile using mingw:

x86_64-w64-mingw32-gcc hello.c -o hello-x64.exe -lpdcurses.dll

And when I run the program, it crashes. Here's it's trace

1

There are 1 best solutions below

0
On

Make sure you're including the curses.h from the PDCurses package, and not the system curses.h (which is ncurses).

Also, although it's probably not relevant to the problem, stdio.h is not needed here.