André Oliveira
André Oliveira

Reputation: 1

Can't include mysql

I have been trying for a while now. I have been asked to do a few modifications on a big program, and it requires a lot of libs. All of them were succesfully added, except mysql.

I downloaded the libs several times and tried a lot of times.

I am on Windows using Netbeans and C++.

The test I decided to do is simple: create an empty program and try to include mysql. I didn't have any success:

#include <cstdlib>
#include <mysql/mysql.h>
using namespace std;

int main(int argc, char** argv) {

    return 0;
}

This program won't work even if I replace #include <mysql/mysql.h> with #include <mysql.h>.

The error NetBeans gives me is the following:

main.cpp:15:25: fatal error: mysql/mysql.h: No such file or directory

These images show how I altered the project options on Linker and C/C++ options:

Parameters

The folder showing on the C image does contain a mysql.h, i triple checked twice. I also have added the paths with includes to CodeAssistance.
Many similar questions were left unanswered for years now on several forums, even on stackoverflow, and I can't seem to work this out. This thread may have a final answer to those of us who stumble upon this.

Upvotes: 0

Views: 907

Answers (2)

Vinay Shukla
Vinay Shukla

Reputation: 1844

It is not able to find the file

At this point, your program would be pointing to something like this:

cl /I "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include"
mysql1.c

So you needed to include the directory that contains mysql.h as well. So the above would changed to:

cl /I "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include" 
/I "C:\Program Files\MySQL\MySQL Server 5.5\include" mysql1.c

Upvotes: 1

MSD
MSD

Reputation: 1407

verify the header file exist in the path /usr/include/mysql/mysql.h or installed some where else. If you have installed the header files somewhere else ( add that location with -I/.

Upvotes: 0

Related Questions