linux下,使用了codeblocks,有各种编写代码的方便之处,但是遇到类似mysql这样的文件,编译时需要附带链接库等,就感觉手足无措,
似乎就没办法编译了,本来是用codeblocks编辑好代码后,仍然通过终端来编译,但是毕竟不是个办法,so,果断百度找办法……
以下是搜到的可以顺利编译Mysql的解决方法:
进入 project ------> build options
a. compiler settings tab -------> other options: 添加 `mysql_config --cflags` (此处非单引号,而是反点,在Tab键的上面一个按键)
b. linker settings tab -> other options: 添加 `mysql_config --libs`
to get codecompletion you probably need to add the include dir to your project
c. search directories tab -> compiler: 添加 /usr/include/mysql
大功告成,可以试试了~

本文介绍如何在Codeblocks环境下成功编译MySQL相关的代码,包括设置编译选项和搜索目录,确保代码完成功能正常工作。
759

被折叠的 条评论
为什么被折叠?



