我正在尝试使用Ubuntu中的Code :: Blocks创建动态库,并创建了下一个文件:
1. main.c
#include "main.h"
#include <stdio.h>
#include <stdlib.h>
void _scan_file (char s[100], Plong a)
{
FILE *f;
f = fopen(s, "r");
int i = 3;
char q[MaxSize + 4];
while (fread(&q[i++], sizeof(char), 1, f)){}
--i;
int k = 0;
if (q[3] == '-' || q[3] == '+')
{
a -> sign = q[3];
q[3] = '0';
}
else
a -> sign = '+';
i--;
q[0] = q[1] = q[2] = '0';
int j;
for (j = i; j >= 3; j -= 4)
{
int p;
for (p = 3; p >= 0; p--)
if (q[j-p] <= '9' && q[j-p] >= '0')
a -> num[k] = a -> num[k] * 10 + q[j - p] - 48;
++k;
}
if (a -> num[--k] == 0)
{
a -> len = k;
}
else
a -> len = k + 1;
fclose(f);
}
main.h
#ifndef MAIN_H_INCLUDED
#define MAIN_H_INCLUDED
#include <stdio.h>
#include <stdlib.h>
const int MaxSize = 1000;
const int _Base = 10000;
const int Max_Pos = 4;
typedef int l_int;
struct long_num
{
int len;
char sign;
l_int num[];
};
typedef struct long_num Llong;
typedef Llong * Plong;
extern void _scan_file (char *s, Plong a);
#endif
但是当我运行此代码时:: Blocks不会创建任何* .so文件 所以我不知道该怎么办...... 任何人都可以帮助我吗?