Mysql-makefile compilation cannot detect function modifications in the header file class

Source: Internet
Author: User
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 ......

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.