dtu server 编译错误

添加 mysql  tomcat  acl 等

 

ervier$ make
make[1]: Entering directory '/home/jason/Desktop/Dtu20200428/servier/src'
g++ -c -I. -I../include -L../lib/ -l_protocol -l_acl -l_acl_cpp -DLINUX2 mysql.cpp -o ../obj//mysql.o
In file included from /usr/include/mysql/mysql.h:86,
from mysql.cpp:6:
/usr/include/mysql/client_plugin.h:108:8: error: using typedef-name ‘MYSQL’ after ‘struct’
108 | struct MYSQL;
| ^~~~~
In file included from ../include/acl_cpp/lib_acl.hpp:84,
from general.h:9,
from mysql.h:3,
from mysql.cpp:1:
../include/acl_cpp/db/db_mysql.hpp:5:25: note: ‘MYSQL’ has a previous declaration here
5 | typedef struct st_mysql MYSQL;
| ^~~~~
In file included from /usr/include/mysql/mysql.h:86,
from mysql.cpp:6:

 

 

 

 

 

 

jason@ubuntu:~/Desktop/DTU/servier$ make
make[1]: Entering directory '/home/jason/Desktop/DTU/servier/src'
g++ ../obj//mysql.o ../obj//main.o ../obj//cmdhandle.o ../obj//group.o ../obj//datahandle.o ../obj//dataprehandle.o ../obj//datasend.o ../obj//system.o ../obj//dtudev.o ../obj//sendmail.o -o ../run//service -L /usr/lib/mysql -lmysqlclient -L ../lib/ -l_acl_cpp -l_protocol -l_acl -lpthread
/usr/bin/ld: ../obj//main.o:(.data.rel.ro._ZTV15master_aio_test[_ZTV15master_aio_test]+0x98): undefined reference to `non-virtual thunk to acl::master_aio::accept_callback(acl::aio_socket_stream*)'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:8: ../run//service] Error 1
make[1]: Leaving directory '/home/jason/Desktop/DTU/servier/src'
make: *** [Makefile:4: all] Error 2
jason@ubuntu:~/Desktop/DTU/servier$

 

原因: 主要是C/C++编译为obj文件的时候并不需要函数的具体实现,只要有函数的原型即可。但是在链接为可执行文件的时候就必须要具体的实现了。

如果错误是未声明的引用,那就是找不到函数的原型,解决办法这里就不细致说了,通常是相关的头文件未包含。

 

 

https://www.cnblogs.com/New-world/p/4511543.html

 

https://www.cnblogs.com/New-world/p/4511983.html

 

posted @ 2020-04-29 09:01  2eggs  Views(303)  Comments(0Edit  收藏  举报