The strange problem is that I wrote a test program and compiled it using makefile. However, if I declare a new function in the header file. when defining this function in the cpp file, make will prompt me ---- error: member function 'intmysql _ soci_test: sum () 'This error is not declared in the class 'MySQL _ soci_test'. However, if I do not need to compile makefile and use g ++ to compile it directly, no problem will occur. Below is my g ++ statement: g ++ mysql_soci_test.hmysql_soci_test.cppmysql_main.cpp-Ii... mysqlc language makefile
The strange problem is that I wrote a test program and compiled it using makefile. However, if I declare a new function in the header file. when defining this function in the cpp file, make will prompt me ---- error: member function 'Int mysql_soci_test: sum () 'is not declared in the class 'MySQL _ soci_test' -- this error, however, if I don't need to compile makefile and use g ++ to compile it directly, no problem will occur.
The following is my g ++ statement: g ++ mysql_soci_test.h mysql_soci_test.cpp mysql_main.cpp-I include/soci-I/usr/include/mysql-L. /lib-L/usr/lib64/mysql-lmysqlclient
Below are the statements in my makefile:
INCLUDES =-I include/soci-I/usr/include/mysql
LIBS =-lmysqlclient-L./lib-L/usr/lib64/mysql
Calc: mysql_main.cpp mysql_soci_test.cpp mysql_soci_test.h
G ++-o calc mysql_soci_test.h mysql_main.cpp mysql_soci_test.cpp-I. $ (des) $ (LIBS)
It seems that there is no problem, but it will lead to errors. Which of the following experts can tell you if they know it? Thanks, online ......