Uploaded image for project: 'MariaDB Connector/C++'
  1. MariaDB Connector/C++
  2. CONCPP-59

Unable to use Connector/C++ on Windows

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Blocker
    • Resolution: Fixed
    • 0.9.4
    • 1.0.0
    • General
    • None
    • Windows 64-bit

    Description

      Using the documentation instructions here -> https://mariadb.com/docs/appdev/connector-cpp/ I attempted to install, configure, and compile a sample C++ application (on Windows 64-bit) that uses Connector/C.

      After installing the latest Windows 64-bit version from https://mariadb.com/downloads/#connectors, I attempted to compile a sample application using:

      g++ -o example example.cpp -std=c++11 -lmariadbcp
      

      To which I received the following:

      PS C:\Users\Rob\Development\dev-example-todo\console\cpp> g++ -o test test.cpp -lmariadbcpp
      test.cpp:2:9: fatal error: mariadbcpp/ConnCpp.h: No such file or directory
      #include<mariadbcpp/ConnCpp.h>
      ^~~~~~~~~~~~~~~~~~~~~~
      compilation terminated.

      After receiving advice from Larwin I removed the "mariadbcpp" library directory from the include, and instead executed a command to include the header files directly:

      g++ -o test test.cpp -std=c++11 -I"C:\Program Files\MariaDB\MariaDB C++ Connector 64-bit\include"
      

      To which I received an error:

      PS C:\Users\Rob\Development\dev-example-todo\console\cpp> g++ -o test test.cpp -std=c+11 -I"C:\Program Files\MariaDB\MariaDB C+ Connector 64-bit\include"
      In file included from C:\Program Files\MariaDB\MariaDB C++ Connector 64-bit\include/ConnCpp.h:24,
      from test.cpp:2:
      C:\Program Files\MariaDB\MariaDB C++ Connector 64-bit\include/Driver.h:24:10: fatal error: buildconf.h: No such file or directory
      #include "buildconf.h"
      compilation terminated.

      I then git cloned the source from https://github.com/mariadb-corporation/mariadb-connector-cpp and built an MSI. Then I manually copied over the buildconf.h file into the installed MariaDB Connector/C folder (in Program Files). After some back and forth testing I discovered I needed to add a few more headers.

      The missing header files:

      • buildconf.h
      • CArray.h
      • DriverManager.h

      However, after copying over the missing headers I still encountered the following error, and am unsure how to resolve:

      C:\Users\Rob\Development\dev-example-todo\console\cpp>g++ -o test test.cpp -std=c+11 -I"C:\Program Files\MariaDB\MariaDB C+ Connector 64-bit\include"
      In file included from C:\Program Files\MariaDB\MariaDB C++ Connector 64-bit\include/ConnCpp.h:39,
      from test.cpp:2:
      C:\Program Files\MariaDB\MariaDB C++ Connector 64-bit\include/Exception.h:47:30: error: function 'sql::SQLString sql::SQLException::getSQLState()' definition is marked dllimport
      MARIADB_EXPORTED SQLString getSQLState()

      { return SqlState.c_str(); }
      ^~~~~~~~~~~
      C:\Program Files\MariaDB\MariaDB C++ Connector 64-bit\include/Exception.h:48:32: error: function 'const char* sql::SQLException::getSQLStateCStr()' definition is marked dllimport
      MARIADB_EXPORTED const char* getSQLStateCStr() { return SqlState.c_str(); }

      ^~~~~~~~~~~~~~~
      C:\Program Files\MariaDB\MariaDB C++ Connector 64-bit\include/Exception.h:52:32: error: function 'const char* sql::SQLException::what() const' definition is marked dllimport
      MARIADB_EXPORTED char const* what() const noexcept override

      { return std::runtime_error::what(); }

      Please reach out to me if you need any more details.

      Attachments

        Activity

          People

            Lawrin Lawrin Novitsky
            rhedgpeth Rob Hedgpeth (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.