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


Hope you can help thanks a lot in advanced cheers


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.

  • 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 Jul 19 '16 at 12:38
  • You called the C++ compiler with $(CFLAG), but you should use $(CFLAGS). – user4759923 Jul 19 '16 at 13:01
  • o yes that was a typo in the comment , it still does not work – karla Jul 19 '16 at 13:07
  • -I/opt/local/include/mysql56 – user4759923 Jul 19 '16 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.