Search code examples
gccmakefilelinkermingw-w64msys2

what the difference of command process from terminal input and from Makefile?


i'm newbie use MinGW64 and msys2.

i have write simple program, just output "hello,world", but it links a dll for test.

#include <stdio.h>

int main() {
    printf("hello, world\n");
    return 0;
}

i run command in terminal like this:

$ gcc -g -Wall -I/usr/local/include -L/usr/local/bin -llua53 --shared -o test.dll main.c

it's works well.

but i write a Makefile use same command like this:

all: main.c

    gcc -g -Wall -I/usr/local/include -L/usr/local/bin -llua53 --shared -o test.dll main.c

the error was output:

$ mingw32-make.exe
gcc -g -Wall -I/usr/local/include -L/usr/local/bin -llua53 --shared -o test.dll main.c
E:/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llua53

this problem confused me, what the difference of command process from terminal input and from Makefile?


Solution

  • mingw32-make.exe is for use with the windows command shell and doesn't understand POSIX paths, you need to use make.exe.