I guess if the mysql library gets updated on the RPi then the files might need to be found and re-copied again so something to bear in mind if problems appear after updating the RPi ever. That's it, for us this worked fine under rasbian and we could access our mysql database no problems. For us files listed in the eclipse build warnings we're all in this folder:īut if you need to search install and use mlocate to find them on the RPi.įind each one and copy it into the same cygwin windows library folder. This works but building the project fails because the library references other files which need to be added in also. Now in eclipse, right click your project > Properties > C/C++ Build > Settings > Cygwin C++ Linker > Libraries. Paste them into your windows machine folder:Ĭ:\cygwin\opt\cross\x-tools\arm-unknown-linux-gnueabi\arm-unknown-linux-gnueabi\sysroot\usr\lib\ (there's also files libmysqlclient_r.a and libmysqlclient_r.so in there but we've not bothered with them) L/usr/lib/arm-linux-gnueabihf -lmysqlclient -lpthread -lz -lm -lrt -ldl Now use this to find out the directory used: G++ main.c `mysql_config -cflags` `mysql_config -libs` Save it in a directory on the RPI, then on the command line go to that directory and use this to compile it: Use this to include it in your C code file:Ĭreate a file called main.c containing some code which uses the mysql library, e.g. sudo usermod -a -G www-data www-data Copy. Next, we need to add the www-data user to the www-data group. The following is not based on any expert knowledge of ours, it is instead the results of our trial and error hitting it with a hammer until it worked… Firstly, in either The Pi’s command line or via SSH, we will need to update the Raspberry Pi and its packages, do this by entering: sudo apt update sudo apt upgrade Copy. If you are not coding on the RPi itself, for instance developing using eclipse for windows, you need to copy the mysql library files if your cross compiler toolchain doesn't have them. Note the single quote marks are correct and should be used as is!īeing Able To Compile Using Eclipse For Windows `mysql_config –cflags` `mysql_config –libs` Go to: Project Properties > Build > Linker > Compilation Line > Additional Options > paste in this: Some of this is based on the excellent guide here.Īdd these to the LIBS and CFLAGS sections of your makefileīeing Able To Compile Using NetBeans For Windows
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |