2014-01-26 122 views
0

我试着用gcc它给了我GCC编译错误未定义的参考`aes256_init”

$ gcc demo.c -o samp.o 

/tmp/cclnweNC.o: In function `main': 
demo.c:(.text+0x12b): undefined reference to `aes256_init' 
demo.c:(.text+0x142): undefined reference to `aes256_encrypt_ecb' 
demo.c:(.text+0x1b2): undefined reference to `aes256_init' 
demo.c:(.text+0x1c9): undefined reference to `aes256_decrypt_ecb' 
demo.c:(.text+0x222): undefined reference to `aes256_done' 
collect2: ld returned 1 exit status 

我曾文件调用aes256.h在这个我已经初始化所有的编译功能,这些功能的主体在aes256.c并试图编译我的主文件demo.c它显示上述错误

+1

@herohuyongtao这是无关紧要的,这是一个链接问题,而不是编译错误。 – Zaffy

回答

1

你想要的东西,如:

$> gcc demo.c aes256.c -o demo 
+0

谢谢工作正常 – suuz

0

如果你想只编译使用 '-c' 标志:

gcc -c main.c -o ... 

如果你想创建可执行文件,那么你必须编译AES256。 c第一次,然后:

gcc -c aes256.c -o aes256.o 
gcc main.c aes256.o -o ...