下面是一个要用到mysql库的C++程序设置:
添加用户头文件:
双击项目—Build Settings—Search Paths:
Library Search Paths: /usr/local/lib
User Header Search Paths: /usr/local/include/
双击项目—Build Settings—Apple LLVM 6.1 -Language-C++
C++ Language Dialect : C++11
双击项目—Build Settings—Linking:
Other Linker Flags: -lmysqlclient
引用其他动态库或静态库:
双击项目—Build Phases–Link Binary With Libraries
等加于:
g++ main.cpp -I /usr/local/include -lmysqlclient -L /usr/local/lib -std=c++11