Проблемы с запуском MySQL Connector в CLion

Я недавно установил MySQL Connector для CLion, поскольку я планирую создать программу, которая будет базой данных MySQL. Я установил Connector с сайта mysql и попробовал код, предоставленный сайтом. После запуска я обнаружил, что там говорится, что boost/shared_ptr.hpp не существует. Поэтому я пошел, чтобы загрузить версию Boost 1.66.0 и установил ее на свой диск C. Я также добавил эти каталоги в мой файл Cmake, но они все еще показывали ошибки.

Это мой файл Cmake:

cmake_minimum_required(VERSION 3.8)
project(Learn_Cpp)


set(CMAKE_CXX_STANDARD 17)

LINK_DIRECTORIES(C:/Program Files/MySQL/MySQL Connector)
LINK_DIRECTORIES(C++ 1.1.9/include C:/Boost/boost_1_66_0)
include_directories("C:/Program Files/MySQL/MySQL Connector C++ 1.1.9/include" "C:/Boost/boost_1_66_0")

set(SOURCE_FILES "C++ Tutorials/Learn.cpp" "C++ Tutorials/ClassFile.cpp" "C++ Tutorials/ClassFile.h" "C++ Tutorials/Learn.cpp")
add_executable(Learn_Cpp ${SOURCE_FILES})

Я попытался решить эту проблему, и другая ошибка показала, что у меня нет файла user.hpp в boost/config.

Вот сообщение об ошибке:

"C:\Program Files\JetBrains\CLion 2017.2.3\bin\cmake\bin\cmake.exe" --build C:\Users\Timothy\CLionProjects\Learn_Cpp\cmake-build-debug --target all -- -j 4
[ 33%] Building CXX object CMakeFiles/Learn_Cpp.dir/C++_Tutorials/Learn.cpp.obj
In file included from C:/Boost/boost_1_66_0/boost/smart_ptr/shared_ptr.hpp:17:0,
                 from C:/Boost/boost_1_66_0/boost/shared_ptr.hpp:17,
                 from C:/PROGRA~1/MySQL/MYSQLC~1.9/include/mysql_connection.h:31,
                 from C:\Users\Timothy\CLionProjects\Learn_Cpp\C++ Tutorials\Learn.cpp:9:
C:/Boost/boost_1_66_0/boost/config.hpp:30:29: fatal error: boost/config/user.hpp: No such file or directory
 #  include BOOST_USER_CONFIG
                             ^
compilation terminated.
CMakeFiles\Learn_Cpp.dir\build.make:62: recipe for target 'CMakeFiles/Learn_Cpp.dir/C++_Tutorials/Learn.cpp.obj' failed
mingw32-make.exe[2]: *** [CMakeFiles/Learn_Cpp.dir/C++_Tutorials/Learn.cpp.obj] Error 1
mingw32-make.exe[1]: *** [CMakeFiles/Learn_Cpp.dir/all] Error 2
CMakeFiles\Makefile2:66: recipe for target 'CMakeFiles/Learn_Cpp.dir/all' failed
Makefile:82: recipe for target 'all' failed
mingw32-make.exe: *** [all] Error 2

Любой, кто может предложить решение этой проблемы, будет очень признателен. Благодарю.

ОБНОВЛЕНИЕ: я исправил ошибку "user.hpp", но получил другое сообщение об ошибке, на этот раз относительно int32_t и uint32_t. Я понятия не имею, что это такое или как решить эту проблему.

Это сообщение об ошибке сейчас:

"C:\Program Files\JetBrains\CLion 2017.2.3\bin\cmake\bin\cmake.exe" --build C:\Users\Timothy\CLionProjects\Learn_Cpp\cmake-build-debug --target Learn_Cpp -- -j 4
Scanning dependencies of target Learn_Cpp
[ 25%] Building CXX object CMakeFiles/Learn_Cpp.dir/C++_Tutorials/ClassFile.cpp.obj
[ 75%] Building CXX object CMakeFiles/Learn_Cpp.dir/C++_Tutorials/Learn.cpp.obj
[ 75%] Building CXX object CMakeFiles/Learn_Cpp.dir/C++_Tutorials/Classes_and_simple_prgm.cpp.obj
In file included from C:/PROGRA~1/MySQL/MYSQLC~1.9/include/cppconn/resultset.h:30:0,
                 from C:\Users\Timothy\CLionProjects\Learn_Cpp\C++ Tutorials\Learn.cpp:13:
C:/PROGRA~1/MySQL/MYSQLC~1.9/include/cppconn/config.h:95:19: error: conflicting declaration 'typedef long int int32_t'
 typedef __int32   int32_t;
                   ^~~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\stdint.h:9:0,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cstdint:41,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\char_traits.h:420,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ios:40,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ostream:38,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\iostream:39,
                 from C:\Users\Timothy\CLionProjects\Learn_Cpp\C++ Tutorials\Learn.cpp:5:
c:\mingw\include\stdint.h:62:15: note: previous declaration as 'typedef int int32_t'
 typedef int   int32_t;
               ^~~~~~~
In file included from C:/PROGRA~1/MySQL/MYSQLC~1.9/include/cppconn/resultset.h:30:0,
                 from C:\Users\Timothy\CLionProjects\Learn_Cpp\C++ Tutorials\Learn.cpp:13:
C:/PROGRA~1/MySQL/MYSQLC~1.9/include/cppconn/config.h:99:26: error: conflicting declaration 'typedef long unsigned int uint32_t'
 typedef unsigned __int32 uint32_t;
                          ^~~~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\stdint.h:9:0,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cstdint:41,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\char_traits.h:420,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ios:40,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ostream:38,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\iostream:39,
                 from C:\Users\Timothy\CLionProjects\Learn_Cpp\C++ Tutorials\Learn.cpp:5:
c:\mingw\include\stdint.h:63:19: note: previous declaration as 'typedef unsigned int uint32_t'
 typedef unsigned  uint32_t;
                   ^~~~~~~~
In file included from C:/PROGRA~1/MySQL/MYSQLC~1.9/include/cppconn/statement.h:30:0,
                 from C:\Users\Timothy\CLionProjects\Learn_Cpp\C++ Tutorials\Learn.cpp:14:
C:/PROGRA~1/MySQL/MYSQLC~1.9/include/cppconn/config.h:95:19: error: conflicting declaration 'typedef long int int32_t'
 typedef __int32   int32_t;
                   ^~~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\stdint.h:9:0,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cstdint:41,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\char_traits.h:420,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ios:40,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ostream:38,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\iostream:39,
                 from C:\Users\Timothy\CLionProjects\Learn_Cpp\C++ Tutorials\Learn.cpp:5:
c:\mingw\include\stdint.h:62:15: note: previous declaration as 'typedef int int32_t'
 typedef int   int32_t;
               ^~~~~~~
In file included from C:/PROGRA~1/MySQL/MYSQLC~1.9/include/cppconn/statement.h:30:0,
                 from C:\Users\Timothy\CLionProjects\Learn_Cpp\C++ Tutorials\Learn.cpp:14:
C:/PROGRA~1/MySQL/MYSQLC~1.9/include/cppconn/config.h:99:26: error: conflicting declaration 'typedef long unsigned int uint32_t'
 typedef unsigned __int32 uint32_t;
                          ^~~~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\stdint.h:9:0,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cstdint:41,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\char_traits.h:420,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ios:40,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ostream:38,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\iostream:39,
                 from C:\Users\Timothy\CLionProjects\Learn_Cpp\C++ Tutorials\Learn.cpp:5:
c:\mingw\include\stdint.h:63:19: note: previous declaration as 'typedef unsigned int uint32_t'
 typedef unsigned  uint32_t;
                   ^~~~~~~~
mingw32-make.exe[3]: *** [CMakeFiles/Learn_Cpp.dir/C++_Tutorials/Learn.cpp.obj] Error 1
mingw32-make.exe[3]: *** Waiting for unfinished jobs....
CMakeFiles\Learn_Cpp.dir\build.make:87: recipe for target 'CMakeFiles/Learn_Cpp.dir/C++_Tutorials/Learn.cpp.obj' failed
CMakeFiles\Makefile2:66: recipe for target 'CMakeFiles/Learn_Cpp.dir/all' failed
mingw32-make.exe[2]: *** [CMakeFiles/Learn_Cpp.dir/all] Error 2
CMakeFiles\Makefile2:78: recipe for target 'CMakeFiles/Learn_Cpp.dir/rule' failed
mingw32-make.exe[1]: *** [CMakeFiles/Learn_Cpp.dir/rule] Error 2
mingw32-make.exe: *** [Learn_Cpp] Error 2
Makefile:117: recipe for target 'Learn_Cpp' failed

0 ответов

Другие вопросы по тегам