LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1092|回复: 1

在linux下makefile出错,被蹂躏了2天,不知道怎么解决,各位大侠帮忙啊!先谢啦!

[复制链接]
发表于 2005-12-19 11:13:13 | 显示全部楼层 |阅读模式
1。我建了sockettest文件夹,在下面有9个文件:sockettest.cpp StdHeader.h SocketClient.h SocketClient.cpp Tcp20Prot.h Tcp20Prot.cpp Trace.h Trace.cpp mysql.cpp

2。然后是autocan,改名字为:configure.in,修改:
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.57)
AC_INIT(sockettest.cpp)
AM_INIT_AUTOMAKE(sockettest,1.0)

# Checks for programs.
AC_PROG_CXX
AC_PROG_CC

# Checks for libraries.

# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h syslog.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_HEADER_TIME
AC_STRUCT_TM

# Checks for library functions.
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([memmove memset select socket])
AC_OUTPUT(Makefile)

3。执行aclocal和autoconf,都生成了预定的文件

4。新建makefile.am,内容为:
AUTOMAKE_OPTION=foreign
bin_PROGRAMS=sockettest
sockettest_SOURCES=sockettest.cpp StdHeader.h SocketClient.h SocketClient.cpp Tcp20Prot.h Tcp20Prot.cpp Trace.h Trace.cpp  mysql.cpp

5。automake --add-missing
[root@localhost sockettest]# automake --add-missing
configure.in: installing `./install-sh'
configure.in: installing `./mkinstalldirs'
configure.in: installing `./missing'
Makefile.am: installing `./INSTALL'
Makefile.am: required file `./NEWS' not found
Makefile.am: required file `./README' not found
Makefile.am: installing `./COPYING'
Makefile.am: required file `./AUTHORS' not found
Makefile.am: required file `./ChangeLog' not found
Makefile.am: installing `./depcomp'


6../configure

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for g++... g++
checking for C++ compiler default output... a.out
checking whether the C++ compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of g++... gcc3
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking syslog.h usability... yes
checking syslog.h presence... yes
checking for syslog.h... yes
checking for unistd.h... (cached) yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking whether time.h and sys/time.h may both be included... yes
checking whether struct tm is in sys/time.h or time.h... time.h
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking for sys/socket.h... (cached) yes
checking types of arguments for select... int,fd_set *,struct timeval *
checking for vprintf... yes
checking for _doprnt... no
checking for memmove... yes
checking for memset... yes
checking for select... yes
checking for socket... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: executing depfiles commands


7.[root@localhost sockettest]# ls -l Makefile
-rw-r--r--    1 root     root        13220 12月 19 10:07 Makefile


8.make(出错啦,过不去,最后面)
source='sockettest.cpp' object='sockettest.o' libtool=no \
depfile='.deps/sockettest.Po' tmpdepfile='.deps/sockettest.TPo' \
depmode=gcc3 /bin/sh ./depcomp \
g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"sockettest\" -DVERSION=\"1.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_FCNTL_H=1 -DHAVE_NETDB_H=1 -DHAVE_NETINET_IN_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYSLOG_H=1 -DHAVE_UNISTD_H=1 -DHAVE__BOOL=1 -DHAVE_STDBOOL_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_SYS_SELECT_H=1 -DHAVE_SYS_SOCKET_H=1 -DSELECT_TYPE_ARG1=int -DSELECT_TYPE_ARG234=\(fd_set\ \*\) -DSELECT_TYPE_ARG5=\(struct\ timeval\ \*\) -DHAVE_VPRINTF=1 -DHAVE_MEMMOVE=1 -DHAVE_MEMSET=1 -DHAVE_SELECT=1 -DHAVE_SOCKET=1  -I. -I.     -g -O2 -c -o sockettest.o `test -f 'sockettest.cpp' || echo './'`sockettest.cpp
source='SocketClient.cpp' object='SocketClient.o' libtool=no \
depfile='.deps/SocketClient.Po' tmpdepfile='.deps/SocketClient.TPo' \
depmode=gcc3 /bin/sh ./depcomp \
g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"sockettest\" -DVERSION=\"1.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_FCNTL_H=1 -DHAVE_NETDB_H=1 -DHAVE_NETINET_IN_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYSLOG_H=1 -DHAVE_UNISTD_H=1 -DHAVE__BOOL=1 -DHAVE_STDBOOL_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_SYS_SELECT_H=1 -DHAVE_SYS_SOCKET_H=1 -DSELECT_TYPE_ARG1=int -DSELECT_TYPE_ARG234=\(fd_set\ \*\) -DSELECT_TYPE_ARG5=\(struct\ timeval\ \*\) -DHAVE_VPRINTF=1 -DHAVE_MEMMOVE=1 -DHAVE_MEMSET=1 -DHAVE_SELECT=1 -DHAVE_SOCKET=1  -I. -I.     -g -O2 -c -o SocketClient.o `test -f 'SocketClient.cpp' || echo './'`SocketClient.cpp
source='Tcp20Prot.cpp' object='Tcp20Prot.o' libtool=no \
depfile='.deps/Tcp20Prot.Po' tmpdepfile='.deps/Tcp20Prot.TPo' \
depmode=gcc3 /bin/sh ./depcomp \
g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"sockettest\" -DVERSION=\"1.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_FCNTL_H=1 -DHAVE_NETDB_H=1 -DHAVE_NETINET_IN_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYSLOG_H=1 -DHAVE_UNISTD_H=1 -DHAVE__BOOL=1 -DHAVE_STDBOOL_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_SYS_SELECT_H=1 -DHAVE_SYS_SOCKET_H=1 -DSELECT_TYPE_ARG1=int -DSELECT_TYPE_ARG234=\(fd_set\ \*\) -DSELECT_TYPE_ARG5=\(struct\ timeval\ \*\) -DHAVE_VPRINTF=1 -DHAVE_MEMMOVE=1 -DHAVE_MEMSET=1 -DHAVE_SELECT=1 -DHAVE_SOCKET=1  -I. -I.     -g -O2 -c -o Tcp20Prot.o `test -f 'Tcp20Prot.cpp' || echo './'`Tcp20Prot.cpp
source='Trace.cpp' object='Trace.o' libtool=no \
depfile='.deps/Trace.Po' tmpdepfile='.deps/Trace.TPo' \
depmode=gcc3 /bin/sh ./depcomp \
g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"sockettest\" -DVERSION=\"1.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_FCNTL_H=1 -DHAVE_NETDB_H=1 -DHAVE_NETINET_IN_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYSLOG_H=1 -DHAVE_UNISTD_H=1 -DHAVE__BOOL=1 -DHAVE_STDBOOL_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_SYS_SELECT_H=1 -DHAVE_SYS_SOCKET_H=1 -DSELECT_TYPE_ARG1=int -DSELECT_TYPE_ARG234=\(fd_set\ \*\) -DSELECT_TYPE_ARG5=\(struct\ timeval\ \*\) -DHAVE_VPRINTF=1 -DHAVE_MEMMOVE=1 -DHAVE_MEMSET=1 -DHAVE_SELECT=1 -DHAVE_SOCKET=1  -I. -I.     -g -O2 -c -o Trace.o `test -f 'Trace.cpp' || echo './'`Trace.cpp
source='mysql.cpp' object='mysql.o' libtool=no \
depfile='.deps/mysql.Po' tmpdepfile='.deps/mysql.TPo' \
depmode=gcc3 /bin/sh ./depcomp \
g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"sockettest\" -DVERSION=\"1.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_FCNTL_H=1 -DHAVE_NETDB_H=1 -DHAVE_NETINET_IN_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYSLOG_H=1 -DHAVE_UNISTD_H=1 -DHAVE__BOOL=1 -DHAVE_STDBOOL_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_SYS_SELECT_H=1 -DHAVE_SYS_SOCKET_H=1 -DSELECT_TYPE_ARG1=int -DSELECT_TYPE_ARG234=\(fd_set\ \*\) -DSELECT_TYPE_ARG5=\(struct\ timeval\ \*\) -DHAVE_VPRINTF=1 -DHAVE_MEMMOVE=1 -DHAVE_MEMSET=1 -DHAVE_SELECT=1 -DHAVE_SOCKET=1  -I. -I.     -g -O2 -c -o mysql.o `test -f 'mysql.cpp' || echo './'`mysql.cpp
g++  -g -O2   -o sockettest  sockettest.o SocketClient.o Tcp20Prot.o Trace.o mysql.o  
mysql.o(.bss+0x0): In function `main':
/work/sockettest/mysql.cpp:21: multiple definition of `mysql'
sockettest.o(.bss+0x20):/work/sockettest/sockettest.cpp:60: first defined here
mysql.o(.text+0x0): In function `main':
/work/sockettest/mysql.cpp:21: multiple definition of `main'
sockettest.o(.text+0xb18):/work/sockettest/sockettest.cpp:524: first defined here
/usr/bin/ld: Warning: size of symbol `main' changed from 688 to 320 in mysql.o
mysql.o(.text+0x140): In function `db_close()':
/work/sockettest/mysql.cpp:45: multiple definition of `db_close()'
sockettest.o(.text+0x2a4):/work/sockettest/sockettest.cpp:251: first defined here
/usr/bin/ld: Warning: size of symbol `db_close()' changed from 30 to 20 in mysql.o
sockettest.o(.text+0x2b0): In function `db_close()':
/work/sockettest/sockettest.cpp:252: undefined reference to `mysql_close'
sockettest.o(.text+0x33d): In function `find_ps(char*)':
/work/sockettest/sockettest.cpp:276: undefined reference to `mysql_query'
sockettest.o(.text+0x351):/work/sockettest/sockettest.cpp:278: undefined reference to `mysql_error'
sockettest.o(.text+0x37d):/work/sockettest/sockettest.cpp:281: undefined reference to `mysql_store_result'
sockettest.o(.text+0x39e):/work/sockettest/sockettest.cpp:283: undefined reference to `mysql_fetch_row'
sockettest.o(.text+0x526):/work/sockettest/sockettest.cpp:326: undefined reference to `mysql_query'
sockettest.o(.text+0x549):/work/sockettest/sockettest.cpp:328: undefined reference to `mysql_error'
sockettest.o(.text+0x572):/work/sockettest/sockettest.cpp:337: undefined reference to `mysql_free_result'
sockettest.o(.text+0x581):/work/sockettest/sockettest.cpp:285: undefined reference to `mysql_error'
sockettest.o(.text+0x64f): In function `connect_db()':
/work/sockettest/sockettest.cpp:348: undefined reference to `mysql_init'
sockettest.o(.text+0x697):/work/sockettest/sockettest.cpp:354: undefined reference to `mysql_real_connect'
sockettest.o(.text+0x6ab):/work/sockettest/sockettest.cpp:356: undefined reference to `mysql_error'
sockettest.o(.text+0x7e3): In function `insert_ps(Tcp20Pack_T*)':
/work/sockettest/sockettest.cpp:403: undefined reference to `mysql_query'
sockettest.o(.text+0x7fb):/work/sockettest/sockettest.cpp:407: undefined reference to `mysql_store_result'
sockettest.o(.text+0x811):/work/sockettest/sockettest.cpp:414: undefined reference to `mysql_fetch_row'
sockettest.o(.text+0x819):/work/sockettest/sockettest.cpp:415: undefined reference to `mysql_num_rows'
sockettest.o(.text+0x823):/work/sockettest/sockettest.cpp:417: undefined reference to `mysql_free_result'
sockettest.o(.text+0x873):/work/sockettest/sockettest.cpp:426: undefined reference to `mysql_query'
sockettest.o(.text+0x88b):/work/sockettest/sockettest.cpp:431: undefined reference to `mysql_store_result'
sockettest.o(.text+0x8a1):/work/sockettest/sockettest.cpp:438: undefined reference to `mysql_fetch_row'
sockettest.o(.text+0x8f6):/work/sockettest/sockettest.cpp:447: undefined reference to `mysql_query'
sockettest.o(.text+0x928):/work/sockettest/sockettest.cpp:455: undefined reference to `mysql_query'
sockettest.o(.text+0x950):/work/sockettest/sockettest.cpp:478: undefined reference to `mysql_free_result'
sockettest.o(.text+0x962):/work/sockettest/sockettest.cpp:457: undefined reference to `mysql_error'
sockettest.o(.text+0x984):/work/sockettest/sockettest.cpp:449: undefined reference to `mysql_error'
sockettest.o(.text+0x9c7):/work/sockettest/sockettest.cpp:469: undefined reference to `mysql_query'
sockettest.o(.text+0x9f4):/work/sockettest/sockettest.cpp:471: undefined reference to `mysql_error'
sockettest.o(.text+0xa16):/work/sockettest/sockettest.cpp:435: undefined reference to `mysql_error'
sockettest.o(.text+0xa3b):/work/sockettest/sockettest.cpp:428: undefined reference to `mysql_error'
sockettest.o(.text+0xa60):/work/sockettest/sockettest.cpp:411: undefined reference to `mysql_error'
sockettest.o(.text+0xa85):/work/sockettest/sockettest.cpp:405: undefined reference to `mysql_error'
Tcp20Prot.o(.text+0xc0): In function `f_startThread()':
/work/sockettest/Tcp20Prot.cpp:141: undefined reference to `pthread_create'
mysql.o(.text+0xb5): In function `main':
/work/sockettest/mysql.cpp:27: undefined reference to `mysql_init'
mysql.o(.text+0xfb):/work/sockettest/mysql.cpp:33: undefined reference to `mysql_real_connect'
mysql.o(.text+0x10f):/work/sockettest/mysql.cpp:35: undefined reference to `mysql_error'
mysql.o(.text+0x14c): In function `db_close()':
/work/sockettest/mysql.cpp:46: undefined reference to `mysql_close'
mysql.o(.text+0x179): In function `find_ps()':
/work/sockettest/mysql.cpp:59: undefined reference to `mysql_query'
mysql.o(.text+0x192):/work/sockettest/mysql.cpp:61: undefined reference to `mysql_error'
mysql.o(.text+0x1bd):/work/sockettest/mysql.cpp:64: undefined reference to `mysql_store_result'
mysql.o(.text+0x1cf):/work/sockettest/mysql.cpp:72: undefined reference to `mysql_fetch_row'
mysql.o(.text+0x1f3):/work/sockettest/mysql.cpp:80: undefined reference to `mysql_free_result'
mysql.o(.text+0x204):/work/sockettest/mysql.cpp:68: undefined reference to `mysql_error'
collect2: ld returned 1 exit status
make: *** [sockettest] Error 1


请问各位大侠我是哪里缺东西了还是设置不对呀,万分感谢!!!!!
发表于 2005-12-19 13:24:19 | 显示全部楼层
看的头疼了,路过,帮顶~~
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表