fatal error: 'mysql/mysql.h' not found (but added in path)

0

I use MAC OS X El capitan 10.11.5 I am trying to understand and execute some code on c++ (it is a lot of files and i am new to c++ a), but when i type "make" to compile everything, it returns the following message

main_func/main_offline_ecap_ratelumi.cpp:16:10: fatal error:     'mysql/mysql.h' file not found

This is what i did: when i type "type -a mysql" it says mysql in /opt/local/bin/mysql but the file mysql.h is in /opt/local/include/mysql56/mysql so i added the path of the mysql.h file in the .profile file and in the .bashrc file (first in only one of them and then on both at the same time) like this for .bashrc file

export PATH=$PATH:/opt/local/include/mysql56/mysql

and in the .profile file

export PATH="/opt/local/include/mysql56/mysql/$PATH"

execute them, restore window but nothing works, the error keeps appearing after "make"

I also added the path provided by the "type command" instead of the actual path of the mysql.h file, but nothing

If i create the bash_profile (because it dos not exist in my computer) script with such file itdoes not work and erases all other paths added befor (for example i can not run ROOT-CERN anymore, so i erase the new bash_profile script and everything goes back to normal)

Also this is my PATH variable

/opt/local/include/mysql56/mysql//opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/include/mysql56/mysql/:/opt/X11/bin

Hope you can help thanks a lot in advanced cheers

karla

Posted 2016-07-19T11:29:12.663

Reputation: 27

Answers

2

You have to add -I(replace this with the path where the mysql includes are) to your CFLAGS. The C++ compiler does not look for includes on the PATH.

user4759923

Posted 2016-07-19T11:29:12.663

Reputation: 136

i added CFLAGS = -I/opt/local/include/mysql56/mysql and then added the variable main_offline_ecap_ratelumi.o : main_func/main_offline_ecap_ratelumi.cpp $(CC) $(CFLAG) -c main_func/main_offline_ecap_ratelumi.cpp $(ROOTINC) in the makefile. CC = g++ ,but still does not find mysql.h – karla – 2016-07-19T12:38:28.873

You called the C++ compiler with $(CFLAG), but you should use $(CFLAGS). – user4759923 – 2016-07-19T13:01:33.013

o yes that was a typo in the comment , it still does not work – karla – 2016-07-19T13:07:08.430

-I/opt/local/include/mysql56 – user4759923 – 2016-07-19T13:49:31.657