命令进程与终端输入和Makefile有什么区别?

时间:2016-05-30 13:23:31

标签: gcc makefile linker mingw-w64 msys2

我是新手使用MinGW64和msys2。

我编写了简单的程序,只输出“hello,world”,但它链接了一个dll进行测试。

#include <stdio.h>

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

我在终端中运行命令如下:

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

它运作良好。

但我写一个Makefile使用相同的命令:

all: main.c

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

输出错误:

$ 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

这个问题让我感到困惑,命令进程与终端输入和Makefile的区别是什么?

1 个答案:

答案 0 :(得分:1)

mingw32-make.exe用于windows命令shell并且不了解POSIX路径,您需要使用make.exe