Discuz!官方免费开源建站系统

 找回密码
 立即注册
搜索

Linux黑客系列(一)Programming!->从开发到编译

[复制链接]
bestwc 发表于 2007-8-24 10:26:25 | 显示全部楼层 |阅读模式
本教程需要一定的黑客技术和Linux系统基础知识.

我们开始:)

首先新建立一个9x9.c的文件 然后用gedit打开文件,这时候输入程序代码 他会自动识别函数 并用不同的颜色标记.

代码如下(很简单的循环嵌套)
#include <stdio.h>
#include <iostream.h>

main()
{
  int iLie;
  int iPri;
  int iResl;


  printf("A Program Print 9X9 form..Code By BestWC...For My 19th Brithday!\n\n");

  for (iLie=1;iLie<=9;iLie++)
        {
            for (iPri=1;iPri<=iLie;iPri++)
                    {
                          iResl=iLie*iPri;
                      printf("%dx%d=%d  ",iPri,iLie,iResl);
                    };
              //printf("\n");
                cout<<endl;
        };
    printf("\n练习了FOR循环的嵌套...Happy Birthday To Me...Enjoy it``` ^_^\n");
}




保存好后我们开始编译:
[root@NewStar8 dns]# cd /Pro-Lea    //进入代码文件的目录
[root@NewStar8 Pro-Lea]# ls        //看看当前目录有哪些文件
9x9    AddSum.c  dns              first        Pro-Lea.tar.gz
9x9.c  b2d      dnsxpl.Idl      PowerFunc
AddSum  b2d.c    dnsxpl.v2.1.zip  PowerFunc.c    //看到9x9.c了吧
[root@NewStar8 Pro-Lea]# gcc -o 9x9 9x9.c    //我们用gcc编译
-o表示输出  这个命令是告诉gcc  把9x9.c的代码编译成9x9的可执行文件(Linux系统不需要扩展名标记)

9x9.c:2:22: iostream.h: 没有那个文件或目录
9x9.c: In function `main':
9x9.c:21: error: `cout' undeclared (first use in this function)
9x9.c:21: error: (Each undeclared identifier is reported only once
9x9.c:21: error: for each function it appears in.)
9x9.c:21: error: `endl' undeclared (first use in this function)

//报错了,看看提示:iostream.h: 没有那个文件或目录 这个是因为我用了c++中的cou 和 cin 函数,而这两个函数在iostream.h标准输入输出流头文件中定义 但gcc找不到
因为gcc普遍用来编译c语言程序 而cou cin在c++出现后才被定义,那么我们换个编译方式.


[root@NewStar8 Pro-Lea]# c++ -o 9x9 9x9.c  //用c++命令来编译
In file included from /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/backward/iostream.h:31,
                from 9x9.c:2:
/usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.//貌似成功了
[root@NewStar8 Pro-Lea]# ./9x9  //./代表当前目录 9x9是可执行文件的名子
A Program Print 9X9 form..Code By BestWC...For My 19th Brithday!

1x1=1
1x2=2  2x2=4
1x3=3  2x3=6  3x3=9
1x4=4  2x4=8  3x4=12  4x4=16
1x5=5  2x5=10  3x5=15  4x5=20  5x5=25
1x6=6  2x6=12  3x6=18  4x6=24  5x6=30  6x6=36
1x7=7  2x7=14  3x7=21  4x7=28  5x7=35  6x7=42  7x7=49
1x8=8  2x8=16  3x8=24  4x8=32  5x8=40  6x8=48  7x8=56  8x8=64
1x9=9  2x9=18  3x9=27  4x9=36  5x9=45  6x9=54  7x9=63  8x9=72  9x9=81

练习了FOR循环的嵌套...Happy Birthday To Me...Enjoy it``` ^_^
[root@NewStar8 Pro-Lea]# //呵呵 运行成功了.


先到这里吧:) 以后我会陆续写一些相关的linux教程 希望对大家有所帮助:)
回复

使用道具 举报

 楼主| bestwc 发表于 2007-8-24 10:26:52 | 显示全部楼层
学习Linux经常碰到的问题就是不会安装软件.

Linux下的软件通常分两类:rpm包 和 gz代码包.现在我来大概讲一下下载到的代码包如何编译和安装.为了给大家一个比较直观的认识,我把以前写的一篇文章放在这里,因为文章中直接讨论并编译了一个非常大的代码集,初学LInux的可以从中很容易得学习到编译Linux代码的大致过程和注意事项:
----------------------------------------------------------------------------------------------
测试环境:RED HAT LINUX FC4
硬件配置:PD 2。8X2 4G内存ECC服务器专用 SATA硬盘 100M政府专用线路

首先使用SVN下载最新的代码:先创建存放代码的目录 然后把代码下载到目录中。
这里说明一下:FC4没有SVN命令  用YUM -Y INSTALL SVN也找不到 你可以到BAIDU去搜索一下就可以找到SVN的安装方法了
[root@NewStar5 Server]#svn co https://svn.sourceforge.net/svnroot/mangos/trunk/
这样就把代码下到/Server中了 等下完他会提示你 取得修正版35XX 证明下载成功 现在LS一下看看东西全不全

OMG。。。好象少了些东西 仔细一看原来.configure Makefiles都没有 看完说明才知道这些东西以前MANGOS小组会放进去后面考虑到WIN用户比较多所以省掉了,前期他们带了一个小工具叫RECONF 现在也没有了。。我先用系统命令试一下看能不能自动生成

[root@NewStar5 Server]#autoreconf --install --force  注意FORCE是强行的意思最好+上 它主要功能就是覆盖原来存在的文件

结果异常退出 去掉FORCE指令发现是生成脚本的问题,我自己修改了一下脚本发现依然不能用。。郁闷 所以找了个早期的版本把RECONF拷贝过来了。

[root@NewStar5 Server]# ./reconf
- aclocal.
- autoconf.
- autoheader.
- automake.
[root@NewStar5 Server]#

再LS一下发现东西都全了 呵呵```下面开始编译。

[root@NewStar5 Server]# ./configure --prefix=/Server --sysconfdir=/Server --with-python --enable-cli --enable-ra
说明:--prefix=/Server 指定了安装目录 --sysconfdir=/Server/etc指定了配置文件的位置 --with-python 这个开启PYTHON功能 FC4本身有这个包如果想升级PYTHON可以使用命令 yum -y install python查看更新 。来看一下结果
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 whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... gcc
checking for C compiler default output file name... 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 gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking build system type... i686-redhat-linux-gnu
checking host system type... i686-redhat-linux-gnu
checking for a sed that does not truncate output... /bin/sed
checking for egrep... grep -E
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognise dependent libraries... pass_all
checking how to run the C preprocessor... gcc -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 dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking how to run the C++ preprocessor... g++ -E
checking for g77... no
checking for f77... no
checking for xlf... no
checking for frt... no
checking for pgf77... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking for f90... no
checking for xlf90... no
checking for pgf90... no
checking for epcf90... no
checking for f95... f95
checking whether we are using the GNU Fortran 77 compiler... yes
checking whether f95 accepts -g... yes
checking the maximum length of command line arguments... 32768
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if gcc static flag  works... yes
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc supports -c -o file.o... yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
configure: creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by g++... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC
checking if g++ PIC flag -fPIC works... yes
checking if g++ supports -c -o file.o... yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
appending configuration tag "F77" to libtool
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for f95 option to produce PIC... -fPIC
checking if f95 PIC flag -fPIC works... yes
checking if f95 supports -c -o file.o... yes
checking whether the f95 linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking for doxygen... /usr/bin/doxygen
checking for pthread_create in -lpthread... yes
checking for compress in -lz... yes
checking for ftime in -lcompat... no
checking for SHA1_Init in -lcrypto... yes
checking for mysql_config... /usr/bin/mysql_config
checking whether to include debug info in library... no
checking whether cli console is enabled... yes
checking whether remote console is enabled... yes
checking for ANSI C header files... (cached) yes
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required
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 limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking malloc.h usability... yes
checking malloc.h presence... yes
checking for malloc.h... yes

看来一切顺利 现在我们来MAKE 一下 ^_^
[root@NewStar5 Server]# make
make  all-recursive
make[1]: Entering directory `/Server'
Making all in dep
make[2]: Entering directory `/Server/dep'
Making all in include
make[3]: Entering directory `/Server/dep/include'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/Server/dep/include'
Making all in lib
make[3]: Entering directory `/Server/dep/lib'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/Server/dep/lib'
Making all in src
make[3]: Entering directory `/Server/dep/src'
Making all in zlib
make[4]: Entering directory `/Server/dep/src/zlib'
if gcc -DHAVE_CONFIG_H -I. -I. -I../../..  -I. -I./../../include -I./../../include/zlib  -g -O2 -MT adler32.o -MD -MP -MF ".deps/adler32.Tpo" -c -o adler32.o adler32.c; \
then mv -f ".deps/adler32.Tpo" ".deps/adler32.Po"; else rm -f ".deps/adler32.Tpo"; exit 1; fi
if gcc -DHAVE_CONFIG_H -I. -I. -I../../..  -I. -I./../../include -I./../../include/zlib  -g -O2 -MT compress.o -MD -MP -MF ".deps/compress.Tpo" -c -o compress.o compress.c; \
then mv -f ".deps/compress.Tpo" ".deps/compress.Po"; else rm -f ".deps/compress.Tpo"; exit 1; fi


if gcc -DHAVE_CONFIG_H -I. -I. -I../../..  -I. -I./../../include -I./../../include/zlib  -g -O2 -MT crc32.o -MD -MP -MF ".deps/crc32.Tpo" -c -o crc32.o crc32.c; \
then mv -f ".deps/crc32.Tpo" ".deps/crc32.Po"; else rm -f ".deps/crc32.Tpo"; exit 1; fi
if gcc -DHAVE_CONFIG_H -I. -I. -I../../..  -I. -I./../../include -I./../../include/zlib  -g -O2 -MT deflate.o -MD -MP -MF ".deps/deflate.Tpo" -c -o deflate.o deflate.c; \
then mv -f ".deps/deflate.Tpo" ".deps/deflate.Po"; else rm -f ".deps/deflate.Tpo"; exit 1; fi
if gcc -DHAVE_CONFIG_H -I. -I. -I../../..  -I. -I./../../include -I./../../include/zlib  -g -O2 -MT example.o -MD -MP -MF ".deps/example.Tpo" -c -o example.o example.c; \
then mv -f ".deps/example.Tpo" ".deps/example.Po"; else rm -f ".deps/example.Tpo"; exit 1; fi
if gcc -DHAVE_CONFIG_H -I. -I. -I../../..  -I. -I./../../include -I./../../include/zlib  -g -O2 -MT gzio.o -MD -MP -MF ".deps/gzio.Tpo" -c -o gzio.o gzio.c; \
then mv -f ".deps/gzio.Tpo" ".deps/gzio.Po"; else rm -f ".deps/gzio.Tpo"; exit 1; fi
if gcc -DHAVE_CONFIG_H -I. -I. -I../../..  -I. -I./../../include -I./../../include/zlib  -g -O2 -MT infback.o -MD -MP -MF ".deps/infback.Tpo" -c -o infback.o infback.c; \
then mv -f ".deps/infback.Tpo" ".deps/infback.Po"; else rm -f ".deps/infback.Tpo"; exit 1; fi
if gcc -DHAVE_CONFIG_H -I. -I. -I../../..  -I. -I./../../include -I./../../include/zlib  -g -O2 -MT inffast.o -MD -MP -MF ".deps/inffast.Tpo" -c -o inffast.o inffast.c; \
then mv -f ".deps/inffast.Tpo" ".deps/inffast.Po"; else rm -f ".deps/inffast.Tpo"; exit 1; fi
if gcc -DHAVE_CONFIG_H -I. -I. -I../../..  -I. -I./../../include -I./../../include/zlib  -g -O2 -MT inflate.o -MD -MP -MF ".deps/inflate.Tpo" -c -o inflate.o inflate.c; \
then mv -f ".deps/inflate.Tpo" ".deps/inflate.Po"; else rm -f ".deps/inflate.Tpo"; exit 1; fi
if gcc -DHAVE_CONFIG_H -I. -I. -I../../..  -I. -I./../../include -I./../../include/zlib  -g -O2 -MT inftrees.o -MD -MP -MF ".deps/inftrees.Tpo" -c -o inftrees.o inftrees.c; \
then mv -f ".deps/inftrees.Tpo" ".deps/inftrees.Po"; else rm -f ".deps/inftrees.Tpo"; exit 1; fi
if gcc -DHAVE_CONFIG_H -I. -I. -I../../..  -I. -I./../../include -I./../../include/zlib  -g -O2 -MT trees.o -MD -MP -MF ".deps/trees.Tpo" -c -o trees.o trees.c; \
then mv -f ".deps/trees.Tpo" ".deps/trees.Po"; else rm -f ".deps/trees.Tpo"; exit 1; fi
if gcc -DHAVE_CONFIG_H -I. -I. -I../../..  -I. -I./../../include -I./../../include/zlib  -g -O2 -MT uncompr.o -MD -MP -MF ".deps/uncompr.Tpo" -c -o uncompr.o uncompr.c; \
then mv -f ".deps/uncompr.Tpo" ".deps/uncompr.Po"; else rm -f ".deps/uncompr.Tpo"; exit 1; fi
if gcc -DHAVE_CONFIG_H -I. -I. -I../../..  -I. -I./../../include -I./../../include/zlib  -g -O2 -MT zutil.o -MD -MP -MF ".deps/zutil.Tpo" -c -o zutil.o zutil.c; \
then mv -f ".deps/zutil.Tpo" ".deps/zutil.Po"; else rm -f ".deps/zutil.Tpo"; exit 1; fi
rm -f libzlib.a
ar cru libzlib.a adler32.o compress.o crc32.o deflate.o example.o gzio.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o
ranlib libzlib.a
make[4]: Leaving directory `/Server/dep/src/zlib'
Making all in zthread
make[4]: Entering directory `/Server/dep/src/zthread'
if /bin/sh ../../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I../../..  -I./../../include -I./../../include/zthread  -g -O2 -MT AtomicCount.lo -MD -MP -MF ".deps/AtomicCount.Tpo" -c -o AtomicCount.lo AtomicCount.cxx; \then mv -f ".deps/AtomicCount.Tpo" ".deps/AtomicCount.Plo"; else rm -f ".deps/AtomicCount.Tpo"; exit 1; fi
mkdir .libs
g++ -DHAVE_CONFIG_H -I. -I. -I../../.. -I./../../include -I./../../include/zthread -g -O2 -MT AtomicCount.lo -MD -MP -MF .deps/AtomicCount.Tpo -c AtomicCount.cxx  -fPIC -DPIC -o .libs/AtomicCount.o
g++ -DHAVE_CONFIG_H -I. -I. -I../../.. -I./../../include -I./../../include/zthread -g -O2 -MT AtomicCount.lo -MD -MP -MF .deps/AtomicCount.Tpo -c AtomicCount.cxx -o AtomicCount.o >/dev/null 2>&1
if /bin/sh ../../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I../../..  -I./../../include -I./../../include/zthread  -g -O2 -MT Condition.lo -MD -MP -MF ".deps/Condition.Tpo" -c -o Condition.lo Condition.cxx; \
then mv -f ".deps/Condition.Tpo" ".deps/Condition.Plo"; else rm -f ".deps/Condition.Tpo"; exit 1; fi
g++ -DHAVE_CONFIG_H -I. -I. -I../../.. -I./../../include -I./../../include/zthread -g -O2 -MT Condition.lo -MD -MP -MF .deps/Condition.Tpo -c Condition.cxx  -fPIC -DPIC -o .libs/Condition.o
g++ -DHAVE_CONFIG_H -I. -I. -I../../.. -I./../../include -I./../../include/zthread -g -O2 -MT Condition.lo -MD -MP -MF .deps/Condition.Tpo -c Condition.cxx -o Condition.o >/dev/null 2>&1
if /bin/sh ../../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I../../..  -I./../../include -I./../../include/zthread  -g -O2 -MT ConcurrentExecutor.lo -MD -MP -MF ".deps/C

make[3]: Leaving directory `/Server/src/mangosd'
make[3]: Entering directory `/Server/src'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/Server/src'
make[2]: Leaving directory `/Server/src'
make[2]: Entering directory `/Server'
make[2]: Nothing to be done for `all-am'.
make[2]: Leaving directory `/Server'
make[1]: Leaving directory `/Server'


[root@NewStar5 Server]# make install
Making install in dep
make[1]: Entering directory `/Server/dep'
Making install in include
make[2]: Entering directory `/Server/dep/include'
make[3]: Entering directory `/Server/dep/include'
make[3]: Nothing to be done for `install-exec-am'.
make[3]: Nothing to be done for `install-data-am'.
make[3]: Leaving directory `/Server/dep/include'
make[2]: Leaving directory `/Server/dep/include'
Making install in lib
make[2]: Entering directory `/Server/dep/lib'
make[3]: Entering directory `/Server/dep/lib'
make[3]: Nothing to be done for `install-exec-am'.
make[3]: Nothing to be done for `install-data-am'.
make[3]: Leaving directory `/Server/dep/lib'
make[2]: Leaving directory `/Server/dep/lib'
Making install in src
make[2]: Entering directory `/Server/dep/src'
Making install in zlib
make[3]: Entering directory `/Server/dep/src/zlib'

好了看来没什么大问题,系统正在自己编译这个过程一般比较长 先休息一下Have a Cpu of Coffee ^_^
当出现这样的文字时证明MAKE成功了:
make[3]: Nothing to be done for `install-data-am'.
make[3]: Leaving directory `/Server/src/mangosd'
make[2]: Leaving directory `/Server/src/mangosd'
make[2]: Entering directory `/Server/src'
make[3]: Entering directory `/Server/src'
make[3]: Nothing to be done for `install-exec-am'.
make[3]: Nothing to be done for `install-data-am'.
make[3]: Leaving directory `/Server/src'
make[2]: Leaving directory `/Server/src'
make[1]: Leaving directory `/Server/src'
make[1]: Entering directory `/Server'
make[2]: Entering directory `/Server'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/Server'
make[1]: Leaving directory `/Server'
接下来我们安装一下使用MAKE INSTALL命令 这里篇幅不够我就不演示了
完成后把编译生成的临时文件清除掉:
[root@NewStar5 Server]# make clean
Making clean in src
make[1]: Entering directory `/Server/src'
Making clean in mangosd
make[2]: Entering directory `/Server/src/mangosd'
rm -f mangos-worldd mangos-worldd
rm -rf .libs _libs
rm -f *.o
rm -f *.lo
make[2]: Leaving directory `/Server/src/mangosd'
Making clean in bindings
make[2]: Entering directory `/Server/src/bindings'
Making clean in universal
make[3]: Entering directory `/Server/src/bindings/universal'
test -z "libmangosscript.la" || rm -f libmangosscript.la
rm -f "./so_locations"
rm -rf .libs _libs
rm -f *.o
rm -f *.lo
make[3]: Leaving directory `/Server/src/bindings/universal'
Making clean in .
make[3]: Entering directory `/Server/src/bindings'
rm -rf .libs _libs
rm -f *.lo
make[3]: Leaving directory `/Server/src/bindings'
make[2]: Leaving directory `/Server/src/bindings'
Making clean in game
make[2]: Entering directory `/Server/src/game'
rm -rf .libs _libs
test -z "libmangosgame.a" || rm -f libmangosgame.a
rm -f *.o
rm -f *.lo
make[2]: Leaving directory `/Server/src/game'
Making clean in realmd
make[2]: Entering directory `/Server/src/realmd'
rm -f mangos-realmd mangos-realmd
rm -rf .libs _libs
rm -f *.o
rm -f *.lo
make[2]: Leaving directory `/Server/src/realmd'
Making clean in shared
make[2]: Entering directory `/Server/src/shared'
rm -rf .libs _libs
test -z "libmangosshared.a libmangosauth.a libmangosconfig.a libmangosdatabase.a libmangosnetwork.a" || rm -f libmangosshared.a libmangosauth.a libmangosconfig.a libmangosdatabase.a libmangosnetwork.a
rm -f *.o
rm -f *.lo
make[2]: Leaving directory `/Server/src/shared'
Making clean in framework
make[2]: Entering directory `/Server/src/framework'
rm -rf .libs _libs
test -z "libmangosframework.a " || rm -f libmangosframework.a
rm -f *.o
rm -f *.lo
make[2]: Leaving directory `/Server/src/framework'
Making clean in .
make[2]: Entering directory `/Server/src'
rm -rf .libs _libs
rm -f *.lo
make[2]: Leaving directory `/Server/src'
make[1]: Leaving directory `/Server/src'
Making clean in sql
make[1]: Entering directory `/Server/sql'
Making clean in updates
make[2]: Entering directory `/Server/sql/updates'
rm -rf .libs _libs
rm -f *.lo
make[2]: Leaving directory `/Server/sql/updates'
Making clean in .
make[2]: Entering directory `/Server/sql'
rm -rf .libs _libs
rm -f *.lo
make[2]: Leaving directory `/Server/sql'
make[1]: Leaving directory `/Server/sql'
Making clean in doc
make[1]: Entering directory `/Server/doc'
rm -rf .libs _libs
rm -f *.lo
make[1]: Leaving directory `/Server/doc'
Making clean in dep
make[1]: Entering directory `/Server/dep'
Making clean in src
make[2]: Entering directory `/Server/dep/src'
Making clean in zthread

make[3]: Entering directory `/Server/dep/src/zthread'
test -z "libZThread.la" || rm -f libZThread.la
rm -f "./so_locations"
rm -rf .libs _libs
rm -f *.o
rm -f *.lo
make[3]: Leaving directory `/Server/dep/src/zthread'
Making clean in zlib
make[3]: Entering directory `/Server/dep/src/zlib'
rm -rf .libs _libs
test -z "libzlib.a" || rm -f libzlib.a
rm -f *.o
rm -f *.lo
make[3]: Leaving directory `/Server/dep/src/zlib'
Making clean in .
make[3]: Entering directory `/Server/dep/src'
rm -rf .libs _libs
rm -f *.lo
make[3]: Leaving directory `/Server/dep/src'
make[2]: Leaving directory `/Server/dep/src'
Making clean in lib
make[2]: Entering directory `/Server/dep/lib'
rm -rf .libs _libs
rm -f *.lo
make[2]: Leaving directory `/Server/dep/lib'
Making clean in include
make[2]: Entering directory `/Server/dep/include'
rm -rf .libs _libs
rm -f *.lo
make[2]: Leaving directory `/Server/dep/include'
Making clean in .
make[2]: Entering directory `/Server/dep'
rm -rf .libs _libs
rm -f *.lo
make[2]: Leaving directory `/Server/dep'
make[1]: Leaving directory `/Server/dep'
Making clean in .
make[1]: Entering directory `/Server'
rm -rf .libs _libs
rm -f *.lo
make[1]: Leaving directory `/Server'

好了 现在看一下目录里有没有多出来东西:LS一下
aclocal.m4      config.h      contrib  install-sh  mangosd.conf  sql
AUTHORS        config.h.in    COPYING  lib          missing      src
autom4te.cache  config.log    dep      libtool      NEWS          stamp-h1
bcpp.cfg        config.status  depcomp  ltmain.sh    README        THANKS
bin            config.sub    doc      Makefile    realmd.conf  win
ChangeLog      configure      etc      Makefile.am  reconf
config.guess    configure.ac  INSTALL  Makefile.in  share

嘿嘿是不是多出来一个BIN目录 进去看看吧 里面就是传说中可以在LINUX下执行的MANGOS程序了 一共两个 如果我没记错名字应该是:
mangos-realmd mangos-worldd两个 注意后面是两个D 功能就不用我说了吧:)

然后到程序目录创建ETC文件夹 这里用来放配置文件
[root@NewStar5 bin]#cd ..
[root@NewStar5 Server]#mkdir etc
[root@NewStar5 Server]#cp mangos.conf /Server/etc
[root@NewStar5 Server]#cp realmd.conf /Server/etc
[root@NewStar5 Server]#cd etc
[root@NewStar5 etc]#这里用命令修改这两个配置文件


[rootNewStar5 etc]#vi mangos.conf
[rootNewStar5 etc]#vi realmd.conf
修改的时候注意 使用VI命令它不允许你修改 直到你按下字母A就可以开始修改了 修改完成后先按ESC键 然后输入:wq 就是保存退出

如果修改错了不想保存 就先按ESC键 然后输入:q!就可以了 。
-----------------------------------------------------------------------------------------------
从上面的两篇文章可以看出,学习Linux环境下的程序开发或编译技巧,只需要记住几个简单的命令便可完全自由操作,但,要想进阶学习,还有一段距离.
总结:单代码文件或少代码文件  使用gcc或 c++命令直接编译,也可自己写makefile文件
大型软件的编译使用:configure------make------make install -------make clean
回复

使用道具 举报

 楼主| bestwc 发表于 2007-8-24 10:27:20 | 显示全部楼层
另外附上本人写的一些小程序,大家可以试着自己编译一下.

AddSum.c:
#include <stdio.h>

main()
{
  long int iNum=0;
  long int iSum=0;
  long int i=1;
  long int e=0;
  printf("Code By BestWC.Add from 1 to a Num simple Program\n");
  printf("\nPlease enter a Random Num:");
  scanf("%d",&iNum);
  //printf("The Num is:%d",iNum);
  if (iNum<0)
    {
      printf("\nPlease Enter an unsigned Num!\n");
      return 0;
    }
  if (iNum>100000)
    {
      printf("\nPlease Enter Some Short One! I'm poor on this Num \n");
      return 0;
    }
  /*if (iNum==13)
    {
      printf("\nYou Must Enter Some Num... \n");
      return 0;
    }
  while(i<=iNum)
    {
      iSum=iSum+i;
      i++;
    }*/
  printf("\nThe result is:%d\n",iSum);
  //printf("ress Any Key to Exit");
  //scanf("%d\n",&e);
  //while(i!=0)
  //{
  printf("\nEnjoy it...^_^\n\n");
  //}
}
回复

使用道具 举报

 楼主| bestwc 发表于 2007-8-24 10:27:41 | 显示全部楼层
PowerFunc.c:
#include <stdio.h>
#include <iostream.h>  //Please Use C++ mode,Not GCC Mode..

double power(double iNum,int iSeq,int iResl)
    {
        for (iSeq;iSeq>0;iSeq--)
                {
                iResl=iResl*iNum;
                };
        return iResl;
      };



int main()
{
    //double power(double iNum,int iSeq);
    double iNum;
    int    iSeq,iResl=1;
    printf("Code By BestWc..For My 19th Birthday!\n");
    printf("\nA Simple Program Use Function Struct...\n");
    cout<<"\nPlease Enter A Random Number:";
    cin>>iNum;
    cout<<"\nPlease Enter A Num Sets The Power To:";
    cin>>iSeq;
    //cout<<iNum;
    //cout<<iSeq;
    iResl=int(power(iNum,iSeq,iResl));
    /*double power(double iNum,int iSeq)
        //{
            for (iSeq;iSeq>0;iSeq--)
                    {
                        iResl=iResl*iNum;
                    };
              return iResl;
        //};*/
    cout<<"\nThe Resualt is:"<<iResl<<endl;
    printf("\n缁冧範浜嗗嚱鏁板畾涔夊拰璋冪敤...Happy Birthday To Me..Enjoy It...^_^\n");
    return 0;
}
回复

使用道具 举报

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

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2025-11-21 23:15 , Processed in 0.114461 second(s), 14 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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