【问题标题】:what the difference of command process from terminal input and from Makefile?终端输入和 Makefile 的命令过程有什么区别?
【发布时间】:2016-05-30 13:23:31
【问题描述】:

我是新手,使用 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的命令过程有什么区别?

【问题讨论】:

    标签: gcc makefile linker mingw-w64 msys2


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2010-09-09
      • 2020-01-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-26
      • 2016-03-17
      • 2011-06-20
      相关资源
      最近更新 更多