简体   繁体   中英

error compiling AEScrypt using mingW-w64 in windows

I downloaded AESCrypt library in order to compile with MingW: https://github.com/paulej/AESCrypt/tree/master/Windows

I receive this error message:

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 `WinMain@16'
collect2.exe: error: ld returned 1 exit status

I am on Windows 7 x64 , I am using MingW-w64 6.1.0 .

This kind of error means you forgot to link the file containing the code of the missing symbol. It is usually a .o or .lib/.a file.

In your case one of the symbols is: sha256_starts(sha256_context*), which is probably in sha256.o. Check the actual link command and make sure it includes this file or the library which includes it.

A makefile like this should make the trick:

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 $<

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM