用官网下载的Juliet test,准备make编译下。
发现make后报以下错误:
std_thread.o: In function `stdThreadCreate':
std_thread.c:(.text+0xae): undefined reference to `pthread_create'
std_thread.o: In function `stdThreadJoin':
std_thread.c:(.text+0x127): undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
Makefile:60: recipe for target 'CWE121_s02' failed
make: *** [CWE121_s02] Error 1
修改Makefile下面这行(60行):
$(TARGET) : $(OBJECTS)
$(CPP) $(LFLAGS) $(OBJECTS) -o $(TARGET)
修改为:
$(TARGET) : $(OBJECTS)
$(CPP) $(OBJECTS) -o $(TARGET) $(LFLAGS)
原因俺也不知道。同组博士大佬告诉我的。