0

我正在使用 Netbeans 和 MacoSX 并安装了 64 位连接器。在构建时,我收到以下错误:

/usr/bin/make -f nbproject/Makefile-Debug.mk SUBPROJECTS= .build-conf
/usr/bin/make  -f nbproject/Makefile-Debug.mk dist/Debug/GNU-MacOSX/inventory
mkdir -p build/Debug/GNU-MacOSX
rm -f build/Debug/GNU-MacOSX/addproduct.o.d
g++    -c -g -Iinclude -Iinclude -MMD -MP -MF build/Debug/GNU-MacOSX/addproduct.o.d -o build/Debug/GNU-MacOSX/addproduct.o addproduct.cpp
                 from addproduct.cpp:10:
In file included from include/mysql_connection.h:30,
include/cppconn/connection.h:31:29: warning: boost/variant.hpp: No such file or directory
In file included from addproduct.cpp:10:
include/mysql_connection.h:31:32: warning: boost/shared_ptr.hpp: No such file or directory
                 from addproduct.cpp:10:
In file included from include/mysql_connection.h:30,
include/cppconn/connection.h:41: error: 'boost' has not been declared
include/cppconn/connection.h:41: error: expected initializer before '<' token
include/cppconn/connection.h:43: error: 'ConnectPropertyVal' was not declared in this scope
include/cppconn/connection.h:43: error: template argument 2 is invalid
include/cppconn/connection.h:43: error: template argument 4 is invalid
include/cppconn/connection.h:43: error: invalid type in declaration before ';' token
In file included from addproduct.cpp:10:
include/mysql_connection.h:75: error: 'ConnectPropertyVal' is not a member of 'sql'
include/mysql_connection.h:75: error: 'ConnectPropertyVal' is not a member of 'sql'
include/mysql_connection.h:75: error: template argument 2 is invalid
include/mysql_connection.h:75: error: template argument 4 is invalid
include/mysql_connection.h:157: error: 'ConnectPropertyVal' is not a member of 'sql'
include/mysql_connection.h:157: error: 'ConnectPropertyVal' is not a member of 'sql'
include/mysql_connection.h:157: error: template argument 2 is invalid
include/mysql_connection.h:157: error: template argument 4 is invalid
include/mysql_connection.h:160: error: 'boost' has not been declared
include/mysql_connection.h:160: error: ISO C++ forbids declaration of 'shared_ptr' with no type
include/mysql_connection.h:160: error: expected ';' before '<' token
make[2]: *** [build/Debug/GNU-MacOSX/addproduct.o] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 538ms)

在 Netbeans 中,我只链接libmysqlcppconn.dylib

我缺少什么文件?为什么要求 BOOST?我需要安装哪些 Boost Lib?

4

2 回答 2

1

mysql_connection.h 包括#include <boost/shared_ptr.hpp>,您可以使用最新版本的 boost 或修改以下行mysql_connection.h以使用 std::shared_ptr :

更新

#include <boost/shared_ptr.hpp>
boost::shared_ptr< NativeAPI::NativeConnectionWrapper > proxy;

#include <memory>
std::shared_ptr< NativeAPI::NativeConnectionWrapper > proxy;
于 2013-01-19T04:54:30.403 回答
0

您是否阅读了标题为“ 21.4.2. 从源代码安装 MySQL Connector/C++ ”的文档?仔细阅读整个页面,然后寻找特定于 MacOSX 的链接......

于 2013-01-19T04:50:58.557 回答