2016-11-18 65 views
0

我下载AESCrypt库,以编译使用MinGW: https://github.com/paulej/AESCrypt/tree/master/Windows错误编译AEScrypt使用的MinGW-W64在Windows

我收到此错误信息:

C:\Users\MyPC\AppData\Local\Temp\cclSPvvW.o:aescrypt.c:(.text+0xa2): undefined re 
ference to `sha256_starts(sha256_context*)' 
C:\Users\MyPC\AppData\Local\Temp\cclSPvvW.o:aescrypt.c:(.text+0xc0): undefined re 
ference to `sha256_update(sha256_context*, unsigned char*, unsigned long)' 
C:\Users\MyPC\AppData\Local\Temp\cclSPvvW.o:aescrypt.c:(.text+0x815): undefined r 
eference to `aes_encrypt(aes_context*, unsigned char*, unsigned char*)' 
C:\Users\MyPC\AppData\Local\Temp\cclSPvvW.o:aescrypt.c:(.text+0x829): undefined r 
eference to `sha256_update(sha256_context*, unsigned char*, unsigned long)' 
C:/Program Files (x86)/mingw-w64/i686-6.1.0-posix-dwarf-rt_v5-rev1/mingw32/bin/. 
./lib/gcc/i686-w64-mingw32/6.1.0/../../../../i686-w64-mingw32/lib/../lib/libming 
w32.a(lib32_libmingw32_a-crt0_c.o):crt0_c.c:(.text.startup+0x39): undefined refe 
rence to `[email protected]' 
collect2.exe: error: ld returned 1 exit status 

我在Windows 7 x64,我使用MingW-w64 6.1.0

+0

显示需要用来编译 –

+0

为AES – SHR

回答

0

这种错误意味着您忘记链接包含缺少符号的代码的文件。它通常是一个.o或.lib/.a文件。

在你的情况下,其中一个符号是:sha256_starts(sha256_context *),它可能在sha256.o中。检查实际的链接命令并确保它包含此文件或包含它的库。

这样一个Makefile应该使绝招:

COMP = gcc 
RM = rm -f 
OBJS = aes.o sha256.o stdafx.o AESCrypt.o AESCryptShellExt.o AESCryptWorkerThreads.o BufferedFile.o ErrorHandling.o PasswdDialog.o ProgressDialog.o 
LDFLAGS = -mwindows 
SERVERLDFLAGS = 
TARGET = aes.exe 

all : $(TARGET) 

$(TARGET) : $(OBJS) 
    $(COMP) $(LDFLAGS) $(DEBUGFLAGS) -o $(TARGET) $^ 

clean : 
    $(RM) *.o 

%.o : %.c %.h 
    $(COMP) $(CFLAGS) -c $< 

%.o : %.cpp %.h 
    $(COMP) $(CFLAGS) -c $< 
+0

使用大写字母,我在Windows命令并没有的.o或IIb /,请看看github存储库,谢谢。 –

+0

链接错误意味着它找不到 – Tom

+0

链接错误意味着它无法找到sha256_starts和sha256_update的二进制代码。如果你看看sha256.c,你会发现这些函数的实现。这意味着你必须编译sha256.c来生成sha256.o,然后当你将文件链接在一起时,这个文件必须与另一个.o一起被包含来获得可执行文件。 – Tom