• 0

Basic C++ project with MySQL Connector


Question

Recently I tried creating same code in JAVA as in C# to brush up on JAVA - a similar helper library for easy querying of database and object mapping In the end I realized that Java is a terrible language (forced exception checking, terrible reflection, and lack of support for generics). Anyway, now I want to do the same thing (or at least attempt to) in C++ to learn C++

First thing first, I am trying to get MySQL connector to work with C++

  • I installed MySQL connector to C:\Program Files\MySQL\MySQL Connector C++ 1.1.6
  • I then created a Win32 Console Application project in VS2015
  • In "Additional Include Directories" I have, ("C/C++" - "General")
  Quote

C:\Program Files\MySQL\MySQL Connector C++ 1.1.6\include\cppconn
C:\Program Files\MySQL\MySQL Connector C++ 1.1.6\include
%(AdditionalIncludeDirectories)

  •  In "Additional Library Directories". Have, ("Linker" - "General")
  Quote

C:\Program Files\MySQL\MySQL Connector C++ 1.1.6\lib\opt
%(AdditionalLibraryDirectories)

  • In "Additional Dependencies" I have,
  Quote

mysqlcppconn-static.lib
libmysql.lib
%(AdditionalDependencies) 

Then I try, to add,

#include "mysql_connection.h"

This file exists in the "include" directory, but I get error "cannot open source file"

 

 

 

 

So then I tried to build the thing from source (C++ libraries incompatible with each other unless built using the same compiler???), first attempt was like,

  Quote

SET PATH=%PATH%;C:\Program Files (x86)\CMake\bin
cd "C:/Users/{0}/Documents/C++/mysql-connector-c++-1.1.6"
cmake -G "Visual Studio 14 2015 Win64" -DBOOST_ROOT:STRING="C:\Users\{0}\Documents\C++\boost_1_59_0" -DMYSQL_CLIENT_STATIC_LINKING=1 -DMYSQL_INCLUDE_DIR="C:\Users\{0}\Documents\C++\MySQL Connector C++ 1.1.6\include"

Which produced a "could not find a "mysql.h"" so... next up I followed a different set of directions based on post by Atul Patil in http://dev.mysql.com/doc/connector-cpp/en/connector-cpp-apps-windows-visual-studio.html which stated that I needed to build the MySQL server first to build the connector.

So I extracted the source for "mysql-5.6.26", navigated via CMD to, mysql-5.6.26/BUILD and ran "cmake .. -G "Visual Studio 14 2015 Win64"" which worked. I opened the generated solution in Visual Studio and mysqlclient which failed with,

Error LNK1181 cannot open input file 'C:/Users/{0}/Documents/C++/mysql-5.6.26/BUILD/libmysql/Debug/clientlib.lib' mysqlclient C:\Users\{0}\Documents\C++\mysql-5.6.26\BUILD\libmysql\LINK 1

Thoughts? TBH getting things to compile and run was my primary reason to avoid C++ in the past - followed by header files

 

 

EDIT,

Pile of ###### doesn't support VS 2015 yet, what a ######## disgrace,

http://forums.mysql.com/read.php?117,634127,634127#msg-634127 

 

Edited by _Alexander

0 answers to this question

Recommended Posts

There have been no answers to this question yet

This topic is now closed to further replies.
  • Posts

    • - What's your salary? Is it more than $100k a year? - Nah, it's $100 mil a year.
    • Compared to my ear buds which are the size of a matchbox, cover a much broader frequency range, and work everywhere without setup? Yeah, still not buying this as a replacement.
    • Meta's Superintelligence team staffed by 50% Chinese talent, 40% ex-OpenAI by Hamid Ganji Mark Zuckerberg's latest big bet at Meta involves building a team of the best AI superstars in the market to lead the so-called Superintelligence Labs. The goal of this team is to develop AI models that will ultimately lead to Artificial General Intelligence (AGI). AGI refers to an AI model with capabilities comparable to, or even beyond, those of the human brain. Achieving human-level cognitive abilities with an AI model requires substantial investments, as well as hiring the best talent to build such a system. That's why Meta is throwing hundreds of millions of dollars at AI researchers from OpenAI, Apple, and other companies to recruit them for its Superintelligence team. A user on X has now shared a spreadsheet that provides us with some unique insights into Meta's Superintelligence team and the origins of its 44 employees. The leaker claims this information comes from an anonymous Meta employee. The listing claims that 50 percent of the staff at the Superintelligence team are from China, which demonstrates the significant role of Chinese or Chinese-origin researchers in Met's AI efforts. Additionally, 75 percent of these staff hold PhDs, and 70 percent of them work as researchers. Interestingly, 40 percent of the staff are ex-OpenAI employees whom Mark Zuckerberg poached from the maker of ChatGPT. Additionally, 20 percent of Meta's Superintelligence team members come from Google DeepMind, and another 15 percent come from Scale AI, a startup that Meta recently acquired in a $15 billion deal. Another interesting point is that 75 percent of the Superintelligence team are first-generation immigrants. The leaker claims that each of these employees is now earning between $10 million and $100 million per year, although Meta still needs to confirm these substantial figures. However, it has already been reported that Meta is offering up to $100 million in signup bonuses to poach the best AI talent from OpenAI and other rivals. The revelation that half of Meta's Superintelligence team consists of Chinese nationals could trigger concerns within the Trump administration and Congress.
    • From a quick Google it seems 6GHz is optional on 802.11be. Ubiquiti has one, Unifi U7 Lite.
    • Disagreed, I feel it’s going somewhere and his role served a purpose - and moreover with maybe what 10 mins of screen time - he had a bit of character development also.
  • Recent Achievements

    • First Post
      nobody9 earned a badge
      First Post
    • One Month Later
      Ricky Chan earned a badge
      One Month Later
    • First Post
      leoniDAM earned a badge
      First Post
    • Reacting Well
      Ian_ earned a badge
      Reacting Well
    • One Month Later
      Ian_ earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      505
    2. 2
      ATLien_0
      207
    3. 3
      Michael Scrip
      206
    4. 4
      Xenon
      139
    5. 5
      +FloatingFatMan
      114
  • Tell a friend

    Love Neowin? Tell a friend!