Makefiles - ошибка при сборке - C (СИ)
Формулировка задачи:
Пытаюсь собрать makefile в windows и при создание makefile вылезает ошибка. Объясните что неправильно делаю.
C:\Users\alex\helloWorld>"C:\MinGW\bin\mingw32-make"
gcc -o hello main.o sqr.o
main.o:main.c.text+0x16): undefined reference to `sqr'
collect2.exe: error: ld returned 1 exit status
makefile:2: recipe for target 'hello' failed
mingw32-make: *** [hello] Error 1
makefile
hello: main.o sqr.o
gcc -o hello main.o sqr.o
main.o: main.c
gcc -c main.c
sqr.o: sqr.s
gcc -c sqr.s
clean:
rm -rf *.o hello
//Main
#include <stdio.h>
main()
{
int i = sqr(11);
printf("Hello world%d\n",i);
}// sqr sqr: .globl sqr sqr: movl 4(%esp), %eax imull %eax, %eax ret
Решение задачи: «Makefiles - ошибка при сборке»
textual
Листинг программы
#include <stdio.h>
#include <stdlib.h>
extern int sqr(int);
int main(int argc, char **argv)
{
int i = sqr(11);
printf("Hello world%d\n", i);
}