无法编译我从老师那里得到的c项目。 (苹果电脑)

时间:2016-10-17 07:12:19

标签: c macos

所以我有一个makefile,当我运行时,我得到了这个:

gcc -Wall -g -L. -DSTUDENT_MODE=1 -o lab2 lab2.c lab2_funcs.c advfuncs.o -lm
ld: warning: ignoring file advfuncs.o, file was built for unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) which is not the architecture being linked (x86_64): advfuncs.o
Undefined symbols for architecture x86_64:
  "__array", referenced from:
      _main in lab2-bdc822.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [all] Error 1

makefile如下所示:

PROGRAM=lab2
SOURCES=lab2.c lab2_funcs.c
CFLAGS=-Wall -g -L.

all: $(SOURCES)
    gcc $(CFLAGS) -DSTUDENT_MODE=1 -o $(PROGRAM) $(SOURCES) advfuncs.o -lm

#teacher: $(SOURCES)
#   gcc $(CFLAGS) -DSTUDENT_MODE=0 -c advfuncs.c
#   gcc $(CFLAGS) -o $(PROGRAM) $(SOURCES) advfuncs.o -lm

clean:
    \rm -f lab2 lab2_funcs.o

我尝试在我的Windows机器上运行此操作,但我得到其他错误。我甚至得到了老师对该项目的完整编译版本,但我似乎无法运行,我只是得到一个错误,我不能这个二进制文件。

0 个答案:

没有答案