Important: Please read the Qt Code of Conduct -

Cannot open include file

  • Hi,

    I am trying to use mysql commands in my Qt project creator and I keep hitting walls.

    Initially, i just wrote "#include "mysql_driver" " and got the "Cannot open include file" error. If I change that to "#include "C:\Program Files\MySQL\MySQL Connector C++ 1.1.3\include\mysql_driver" " then the first error is replace with "error: C1083: Cannot open include file: 'boost/scoped_ptr.hpp': No such file or directory"

    I think this is because mysql_driver.h calls boost methods, but cannot find them. I can go through and add every single header file I need and every file that they call, but it seems like there should be an easier way.

    Does anyone have any ideas what is up with this?

    Thanks for your help

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Just to be sure: you want to connect to a mysql database ? Why not use the QtSql module ?

  • This is the first time I have ever used mysql and I'm trying to adapt someone else's code. I tried using the #include <QtSql> but the commands that it uses are different from my predecessor's and I don't sql well enough to adapt them. For instead, he used:
    sql::Driver *driver;
    sql::Connection *con;
    sql::Statement *stmt;
    sql::ResultSet *res;

    to create his connector variables, which didn't work when I tried it with QtSql.

    I would like to learn more about what he was trying to do and how QtSql works, but I thought it might be easier just to replicate his code.


Log in to reply