锐英源软件
第一信赖

精通

英语

开源

擅长

开发

培训

胸怀四海 

第一信赖

当前位置:锐英源 / 在线教育 / 教学花絮:Linux下C++学习总结
服务方向
人工智能数据处理
人工智能培训
kaldi数据准备
小语种语音识别
语音识别标注
语音识别系统
语音识别转文字
kaldi开发技术服务
软件开发
运动控制卡上位机
机械加工软件
软件开发培训
Java 安卓移动开发
VC++
C#软件
汇编和破解
驱动开发
联系方式
固话:0371-63888850
手机:138-0381-0136
Q Q:396806883
微信:ryysoft

Linux C++部分学习从一开始就不是很顺利,正如孙老师所言,学Linux会很辛苦,需要多下功夫。在Windows上安装虚拟机VMware并在虚拟机上安装Linux就费了很多时间,老师提供的VMware7.1.4装好后再安装老师提供的RedHat Linux Server 6.1-i386,结果不能正确安装code::blocks,因为Linux里没有安装gcc和g++。尝试了很长时间,在Software Centre里找不到distributes,利用sudo apt-get install 也不行。又尝试下载 tar ball,结果提示缺些库函数,下载了提示的库函数在./configure时又提示缺其他的库函数。最后下载的库函数源文件可以正确走过./configure,生成makefile,但 运行make 的时候又提示错误。

在网上下载了个VMware-9.0.1,安装了最新版的Ubuntu Linux 14.04后,结果很容易地通过Software Centre 找到gcc,g++,并安装好。后又顺利安装好了Code::Blocks。到此为止,好像用了一两个月,才算开始正式接触在Linux下编译C/C++程序。通过在Code::Blocks里编译运行老师教材里提供的练习程序,有了对在Code::Blocks 和 在Linux终端窗口编译C/C++程序的初步感觉。同时通过前面提到的长时间的安装,卸载Linux,各应用程序和库文件,对Linux的环境和在Linux环境下开发程序也有了初步的感觉。真的挺辛苦,不过回过头一看,感觉不像以前那样害怕Linux了。

培训教材的第三章我是结合我手头的一本《UNIX和Shell程序设计》中的部分章节一起学习的。从Bash(外壳)到Shell编程的一些知识点。到了3.7 Debugging一节,以前出现的问题又出现了。为了做练习题,需要安装memprof,结果Ubuntu Software Center中没有,用sudo apt-get install也不能安装。下载源文件自己./configure,提示没有gtk+-2.0和libglade-2.0,用sudo apt-get install gtk+-2.0可以正确安装gtk+库,但同样方法不适用于libglade-2.0。下载libglade-2.0源文件,./configure时提示确libxml,下载libxml源文件,运行./configure后能得到 “Done configuring”的成功提示,make 后 make install都很顺利,没有错误提示,我感觉应该是安装成功了。回头到libglade目录里 ./configure,这次能走通,但没有见到“Done configuring”的成功提示,只是在最后得到下面的结果,其中有几个no和一个false,都用红体字标识了:

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 if debuging support was requested... yes
checking for gcc... gcc
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 gcc accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for strerror in -lcposix... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
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 dependant libraries... file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )
checking command to parse /usr/bin/nm -B output... ok
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 for file... /usr/bin/file
checking for ranlib... ranlib
checking for strip... strip
checking for objdir... .libs
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.lo... yes
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking whether the linker (/usr/bin/ld) supports shared libraries... yes
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking whether -lc should be explicitly linked in... no
creating libtool
checking for pkg-config... /usr/bin/pkg-config
checking for GTK+ - version >= 2.0.0... yes (version 2.24.23)
checking for gtk_plug_get_type... yes
checking for pkg-config... (cached) /usr/bin/pkg-config
checking for libxml-2.0 >= 2.4.10 atk >= 1.0.0 gtk+-2.0 >= 2.0.0... yes
checking LIBGLADE_CFLAGS... -pthread -I/usr/local/include/libxml2 -I/usr/include/atk-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/freetype2 -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/harfbuzz 
checking LIBGLADE_LIBS... -L/usr/local/lib -lxml2 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfontconfig -lgobject-2.0 -lglib-2.0 -lfreetype 
checking for gtkdoc-mkdb... false
checking for ranlib... (cached) ranlib
checking for gcc option to accept ANSI C... none needed
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking for off_t... yes
checking for size_t... yes
checking for working alloca.h... yes
checking for alloca... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for getpagesize... yes
checking for working mmap... yes
checking argz.h usability... yes
checking argz.h presence... yes
checking for argz.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 nl_types.h usability... yes
checking nl_types.h presence... yes
checking for nl_types.h... yes
checking malloc.h usability... yes
checking malloc.h presence... yes
checking for malloc.h... yes
checking for string.h... (cached) yes
checking for unistd.h... (cached) yes
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking for getcwd... yes
checking for munmap... yes
checking for putenv... yes
checking for setenv... yes
checking for setlocale... yes
checking for strchr... yes
checking for strcasecmp... yes
checking for strdup... yes
checking for __argz_count... yes
checking for __argz_stringify... yes
checking for __argz_next... yes
checking for LC_MESSAGES... yes
checking libintl.h usability... yes
checking libintl.h presence... yes
checking for libintl.h... yes
checking for dgettext in libc... yes
checking for msgfmt... /usr/bin/msgfmt
checking for dcgettext... yes
checking for gmsgfmt... /usr/bin/msgfmt
checking for xgettext... /usr/bin/xgettext
./configure: line 10180: ./po/POTFILES.in: No such file or directory
checking for Python >= 2.0 with expat support... /usr/bin/python
configure: creating ./config.status
config.status: creating Makefile
config.status: creating libglade.spec
config.status: creating glade/Makefile
config.status: creating doc/Makefile
config.status: creating tests/Makefile
config.status: creating libglade-2.0.pc
config.status: creating libglade-convert
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing default-1 commands

This is the development branch of libglade
If you want something that works with gtk+ 1.2, checkout the
libglade-1-0 branch with the following command
cvs update -r libglade-1-0 .
上面可疑的地方是这样一条警告:“./configure: line 10180: ./po/POTFILES.in: No such file or directory”。我查看了./po/目录,里面是空的,百度过,没有找到解决方案。Google到了一个回答,说可以忽略这个警告。不知该如何解决这个问题。

如果强行执行make,得到下面的结果:
tim@ubuntu:~/Downloads/libglade-2.0.0$ make
make  all-recursive
make[1]: Entering directory `/home/tim/Downloads/libglade-2.0.0'
Making all in glade
make[2]: Entering directory `/home/tim/Downloads/libglade-2.0.0/glade'
source='glade-init.c' object='glade-init.lo' libtool=yes \
depfile='.deps/glade-init.Plo' tmpdepfile='.deps/glade-init.TPlo' \
depmode=gcc3 /bin/bash ../depcomp \
/bin/bash ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -DG_LOG_DOMAIN=\"libglade\" -I.. -pthread -I/usr/local/include/libxml2 -I/usr/include/atk-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/freetype2 -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/harfbuzz   -DGLADE_LIBDIR=\""/usr/local/lib"\" -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGNOME_DISABLE_DEPRECATED    -g -O2 -Wall -std=c9x -c -o glade-init.lo `test -f 'glade-init.c' || echo './'`glade-init.c
rm -f .libs/glade-init.lo
gcc -DHAVE_CONFIG_H -I. -I. -I.. -DG_LOG_DOMAIN=\"libglade\" -I.. -pthread -I/usr/local/include/libxml2 -I/usr/include/atk-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/freetype2 -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/harfbuzz -DGLADE_LIBDIR=\"/usr/local/lib\" -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGNOME_DISABLE_DEPRECATED -g -O2 -Wall -std=c9x -c glade-init.c -MT glade-init.lo -MD -MP -MF .deps/glade-init.TPlo  -fPIC -DPIC -o .libs/glade-init.lo
In file included from glade-init.c:34:0:
glade-private.h:33:5: error: unknown type name 'GtkTooltips'
GtkTooltips *tooltips; /* if not NULL, holds all tooltip info */
^
make[2]: *** [glade-init.lo] Error 1
make[2]: Leaving directory `/home/tim/Downloads/libglade-2.0.0/glade'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/tim/Downloads/libglade-2.0.0'
make: *** [all] Error 2


装不上memprof,百度到了个类似功能的替代品:valgrind,就是这个工具没有图形界面。

个人工作经验的理解:调试是找到程序问题和解决问题的“过程”,这句话太经典了,我在这章的学习过程中对此论述有了很深的理解。

我现在已经自学完3.11 Processes 进程。

请老师给发后面的视频。

友情链接
版权所有 Copyright(c)2004-2021 锐英源软件
公司注册号:410105000449586 豫ICP备08007559号 最佳分辨率 1024*768
地址:郑州大学北校区院(文化路97号院)内