在c程序linux中包含libmcrypt

时间:2014-11-06 17:25:04

标签: c linux ubuntu

我想编译并运行一个使用AES加密系统发送消息的C程序。我已经下载了

我从这里下载了libmcrypt http://sourceforge.net/projects/mcrypt/files/Libmcrypt/ 我认为它适用于Linux

我创建了一个' crypt.c'在存档的根文件夹中:

#include<stdio.h>
#include "lib/mcrypt.c"

main()
{
    printf("Hello World");
}

我创建了一个&#39; crypt.sh&#39;那将编译并运行程序:

rm crypt.exe; gcc -o crypt.exe crypt.c -l "lib"; ./crypt.exe $1 $2;

我收到此错误

In file included from lib/mcrypt.c:43:0,
                 from crypt.c:5:
lib/libdefs.h:80:3: error: #error "Cannot find a 32 bit integer in your system, sorry."
 # error "Cannot find a 32 bit integer in your system, sorry."
   ^
lib/libdefs.h:88:3: error: #error "Cannot find a 16 bit integer in your system, sorry."
 # error "Cannot find a 16 bit integer in your system, sorry."
   ^
lib/libdefs.h:94:3: error: #error "Cannot find an 8 bit char in your system, sorry."
 # error "Cannot find an 8 bit char in your system, sorry."
   ^
lib/libdefs.h:101:4: error: #error "Neither memmove nor bcopy exists on your system."
 #  error "Neither memmove nor bcopy exists on your system."
    ^
In file included from lib/mcrypt.c:47:0,
                 from crypt.c:5:
lib/mcrypt_internal.h:30:2: error: unknown type name ‘byte’
  byte *akey;
  ^
lib/mcrypt_internal.h:32:2: error: unknown type name ‘byte’
  byte *abuf; /* holds the mode's internal buffers */
  ^
lib/mcrypt_internal.h:35:2: error: unknown type name ‘byte’
  byte *keyword_given;
  ^
In file included from crypt.c:5:0:
lib/mcrypt.c: In function ‘internal_init_mcrypt’:
lib/mcrypt.c:95:2: warning: incompatible implicit declaration of built-in function ‘free’ [enabled by default]
  free(sizes);
  ^
lib/mcrypt.c:100:2: warning: incompatible implicit declaration of built-in function ‘memmove’ [enabled by default]
  memmove(td->keyword_given, key, lenofkey);
  ^
lib/mcrypt.c: In function ‘mcrypt_free’:
lib/mcrypt.c:257:2: warning: incompatible implicit declaration of built-in function ‘free’ [enabled by default]
  free(ptr);
  ^
crypt.sh: 1: crypt.sh: ./crypt.exe: not found

现在主要的问题是:

如何在LIBRARY中导入ANSI C

我需要加密C中的一些数据并通过互联网发送curl(我管理的库使用它)

这就是我设法在我的程序中包含curl库的方法:

rm curlate.exe; gcc -o curlate.exe curlate.c -l "curl"; ./curlate.exe $1 $2;

其中curlstart.sh附近的文件夹,只包含.h个文件。

0 个答案:

没有答案