运行create_xml.c时遇到的问题_xml文件操纵第一步

 1 运行create_xml.c时遇到的问题
 2 
 3 jason@ubuntu:~/Desktop/mxml-2.9$ ./configure --enable-threads
 4 jason@ubuntu:~/Desktop/mxml-2.9$ make
 5 jason@ubuntu:~/Desktop/mxml-2.9$ sudo make install
 6 //依照以前的经验,要开启多线程的支持,编译,安装
 7 
 8 
 9 
10 jason@ubuntu:~/Desktop/project_xml_mysql$ ls -l
11 total 8
12 -rw-rw-r-- 1 jason jason 1447 Sep 15 02:41 create_xml.c
13 -rw-rw-r-- 1 jason jason 1369 Sep 15 02:34 create_xml.c~
14 //编写源代码
15 jason@ubuntu:~/Desktop/project_xml_mysql$ gcc -o create_xml create_xml.c -lmxml
16 //usr/local/lib/libmxml.so: undefined reference to `pthread_getspecific'
17 //usr/local/lib/libmxml.so: undefined reference to `pthread_key_create'
18 //usr/local/lib/libmxml.so: undefined reference to `pthread_once'
19 //usr/local/lib/libmxml.so: undefined reference to `pthread_setspecific'
20 //usr/local/lib/libmxml.so: undefined reference to `pthread_key_delete'
21 collect2: error: ld returned 1 exit status
22 //可以看出是没有多线程的支持
23 jason@ubuntu:~/Desktop/project_xml_mysql$ gcc -o create_xml create_xml.c -lmxml -lpthread
24 jason@ubuntu:~/Desktop/project_xml_mysql$ ls
25 create_xml  create_xml.c  create_xml.c~
26 //这样可以得到可执行文件
27 jason@ubuntu:~/Desktop/project_xml_mysql$ ./create_xml 
28 ./create_xml: error while loading shared libraries: libmxml.so.1: cannot open shared object file: No such file or directory
29 //运行的时候出现了另外的一个问题
30 //参考文献:http://blog.csdn.net/dikcychen2011/article/details/9765787
31 jason@ubuntu:~/Desktop/project_xml_mysql$ cat /etc/ld.so.conf
32 include /etc/ld.so.conf.d/*.conf
33 jason@ubuntu:/etc$ sudo vi ld.so.conf
34 jason@ubuntu:/etc$ cat ld.so.conf
35 include /etc/ld.so.conf.d/*.conf
36 include /usr/local/lib
37 //安装上面的步骤改变etc下面的那个文件
38 jason@ubuntu:/etc$ cd ~/Desktop/project_xml_mysql/
39 jason@ubuntu:~/Desktop/project_xml_mysql$ ls
40 create_xml  create_xml.c  create_xml.c~
41 jason@ubuntu:~/Desktop/project_xml_mysql$ sudo ./create_xml 
42 ./create_xml: error while loading shared libraries: libmxml.so.1: cannot open shared object file: No such file or directory
43 jason@ubuntu:~/Desktop/project_xml_mysql$ ldconfig
44 /sbin/ldconfig.real: Can't create temporary cache file /etc/ld.so.cache~: Permission denied
45 jason@ubuntu:~/Desktop/project_xml_mysql$ sudo ldconfig
46 //这个ldconfig是使得配置使能
47 jason@ubuntu:~/Desktop/project_xml_mysql$ sudo ./create_xml 
48 jason@ubuntu:~/Desktop/project_xml_mysql$ ls
49 create_xml  create_xml.c  create_xml.c~  creat_new_check.xml
50 //运行之后产生新的xml文件
51 jason@ubuntu:~/Desktop/project_xml_mysql$ cat creat_new_check.xml 
52 <?xml version="1.0" encoding="utf-8"?><data><node>val1</node><node>val2</node><node>val3</node><group><node>val4</node><node>val5</node><node>val6</node></group><node>val7</node><node>val8</node></data>

 

posted @ 2015-09-15 18:27  kongchung  阅读(497)  评论(0编辑  收藏  举报