项目wangkangluo1

一.目录结构和源码:

下载地址http://u.115.com/file/dn9rgh86


目录结构:

   wangkangluo1

        --Makefile.am

        --src

                --Makefile.am

                --findStringsWithoutCase.h

                --findStringsWithoutCase.c

代码如下:

 wangkangluo1

       --Makefile.am

SUBDIRS = src 

wangkangluo1

      --src

            --Makefile.am

AUTOMAKE_OPTIONS=foreign                                                                                                                                                         
lib_LTLIBRARIES
= libwangkangluo1.la

libwangkangluo1_la_SOURCES
= findStringsWithoutCase.c stringsReplace.c

wangkangluo1include_HEADERS
= findStringsWithoutCase.h stringsReplace.h wangkangluo1.h

wangkangluo1includedir
= ${includedir}/wangkangluo1/

  

  

二.makefile步骤:

 $autoscan 

            生成configure.scan  --> 重命名 configure.ac

    代码如下:

     wangkangluo1

           --configure.ac

   

#                                               -*- Autoconf -*-                                                                                                                 
# Process
this file with autoconf to produce a configure script.

AC_PREREQ([
2.65])
AC_INIT(wangkangluo1
, 1.01, 304243050@qq.com)
AM_INIT_AUTOMAKE()
#AC_CONFIG_SRCDIR([src
/findWithoutCase.h])
#AC_CONFIG_HEADERS([config.h])

# Checks
for programs.
AC_PROG_CC
AC_PROG_LIBTOOL

# Checks
for libraries.

# Checks
for header files.
AC_CHECK_HEADERS([stdlib.h
string.h])

# Checks
for typedefs, structures, and compiler characteristics.

# Checks
for library functions.
AC_FUNC_MALLOC
AC_CHECK_FUNCS([memset pow strstr])

#AC_CONFIG_FILES([Makefile
# src
/Makefile])
AC_OUTPUT(src/Makefile)
  

$ aclocal
$ autoconf
$ libtoolize -f -c
$ automake -a
$ touch NEWS
$ touch README
$ touch AUTHORS
$ touch ChangeLogs
$ automake
$ ./configure
$ make
$ sudo make install
   $sudo ldconfig            <----注意要将环境应用

三.测试:


test.c

#include        <errno.h>                                                                                                                                                        
#include
<math.h>
#include
<stdio.h>
#include
<stdlib.h>
#include
<string.h>
#include
"findWithoutCase.h"

/*
* === FUNCTION ======================================================================
* Name: main
* Description: main function
* =====================================================================================
*/
int
main (
int argc, char *argv[] )
{
char *strings = "fjdkasjfkdjsipho中H";
char *key = "中h";
char *pos = find_strings_without_case(strings, key);
printf (
"\nProgram %s\n\n", pos);
free(pos);
printf (
"\nProgram %s\n\n", argv[0] );

return EXIT_SUCCESS;
}
/* ---------- end of function main ---------- */

  

编译:gcc -g -Wall -O0 test.c -o test -lm  -lwangkangluo1

运行:./test

 

*****output*******
Program 中H

  

原文地址:https://www.cnblogs.com/wangkangluo1/p/2112059.html