MySQL Connector / C ++的编译示例/ standalone_example.cpp失败

时间:2014-09-02 21:59:03

标签: c++ mysql mysql-connector

我下载了MySQL Connector / C ++ 1.1.4的源代码,并且能够编译和安装它。但是,编译示例失败。

clang++ -o test_install -I/usr/local/include -I/usr/local/include/cppconn -lmysqlcppconn standalone_example.cpp

失败
standalone_example.cpp:118:18: error: use of undeclared identifier 'EXAMPLE_FUNCTION'
            cout << "(" << EXAMPLE_FUNCTION << ") on line " << __LINE__ << endl;
                           ^
1 error generated.

这是mysql doc的链接:http://dev.mysql.com/doc/connector-cpp/en/connector-cpp-installation-source-unix.html

1 个答案:

答案 0 :(得分:0)

standalone_example.cpp缺少一个include。添加...

#include "examples.h"

......它编译。有一些警告。