首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在windows中使用mingW-w64编译AEScrypt时出错

在windows中使用mingW-w64编译AEScrypt时出错
EN

Stack Overflow用户
提问于 2016-11-19 00:20:12
回答 1查看 146关注 0票数 0

为了用MingW编译,我下载了AESCrypt库:https://github.com/paulej/AESCrypt/tree/master/Windows

我收到此错误消息:

代码语言:javascript
复制
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

我在用Windows 7 x64,我用的是MingW-w64 6.1.0

EN

回答 1

Stack Overflow用户

发布于 2016-11-19 00:25:18

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

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

像这样的makefile应该可以做到这一点:

代码语言:javascript
复制
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
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40681715

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档