If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Re: MySQL and C++ lib error

Originally Posted by Paul McKenzie

You list all of these things you did, but no one knows if you did any of these correctly.
Nothing in that error message suggests that the library is 64-bit.
Tell us what you mean by "linked". There are multiple ways to specify a library to link to in Visual Studio.

Regards,

Paul McKenzie

1. well, I downloaded win installer from mysql website, and I dont really think this can be done wrong
2. I installed full version by selecting "full" on the start of installation, it did install connectors and everything it could
3. and 4. im not using external libs for the first time, I also did this correctly
5. i linked it under input

I had same error with lua lib that I accidentaly built for 64 bit, everything was linked but I still got the error telling me that I dont have lib included in my project

Re: MySQL and C++ lib error

Do you mean you added the lib pathname in the Additional Dependencies list?

And BTW, are there different .lib versions for debug/release builds?

yes, the debug version is in debug folder within lib folder

edit: just to make this clear, in lib folder are 2 libs, libmysql and mysqlclient, both of them are linked to my project, there's debug folder with ONLY mysqlclient, which im not using at all (only the first 2 in lib folder), also there's libmysql but DLL, not a lib, maybe I need to include all libs AND dll? if so, how do I include dll? i never worked with those

Re: MySQL and C++ lib error

edit: just to make this clear, in lib folder are 2 libs, libmysql and mysqlclient, both of them are linked to my project,

That doesn't make it clear in terms of what your exact steps are in Visual Studio as to how you're doing this "linking".

In the Properties for the project:

1) Linker -> General -> Additional Library Directories... Did you specify the directory where the .lib file(s) are found?

2) Linker -> Input -> Additional Dependencies... If you did step 1), in this step, did you specify the name of the library, including the .lib extension (i.e. mylib.lib)?

there's debug folder with ONLY mysqlclient, which im not using at all (only the first 2 in lib folder), also there's libmysql but DLL, not a lib, maybe I need to include all libs AND dll? if so, how do I include dll? i never worked with those

Just because you have folders on your machine means nothing if you don't follow the steps required for the Visual Studio IDE and the linker to find these library files.

As to the DLL, the DLL is not used in the build process. The DLL is relevant only when you run your program.

Re: MySQL and C++ lib error

That doesn't make it clear in terms of what your exact steps are in Visual Studio as to how you're doing this "linking".

In the Properties for the project:

1) Linker -> General -> Additional Library Directories... Did you specify the directory where the .lib file(s) are found?

2) Linker -> Input -> Additional Dependencies... If you did step 1), in this step, did you specify the name of the library, including the .lib extension (i.e. mylib.lib)?
Just because you have folders on your machine means nothing if you don't follow the steps required for the Visual Studio IDE and the linker to find these library files.

As to the DLL, the DLL is not used in the build process. The DLL is relevant only when you run your program.

Re: MySQL and C++ lib error

You're doing something wrong, since MySQL is used by thousands of C++ coders without issue.

Unless we see for ourselves that

1) those are the correct directories (this should be a full path name), and
2) you are following the steps that I outlined in detail (the actual items in the Properties),

then there is nothing else we can tell you. Adding libraries to be linked is very simple and should be no issue if the directories specified are correct, the name of the libraries are correct, and you're specifying these in the Visual Studio IDE correctly.

Re: MySQL and C++ lib error

You're doing something wrong, since MySQL is used by thousands of C++ coders without issue.

Unless we see for ourselves that

1) those are the correct directories (this should be a full path name), and
2) you are following the steps that I outlined in detail (the actual items in the Properties),

then there is nothing else we can tell you. Adding libraries to be linked is very simple and should be no issue if the directories specified are correct, the name of the libraries are correct, and you're specifying these in the Visual Studio IDE correctly.

the folder path is 100% correct since I selected it within the interface (when u're adding it to that line and selecting a folder)

Do not add mysqlclient.lib.

The functions you're calling are within the libmysql.dll module, therefore the library that you should be linking to is libmysql.lib. Don't add libraries that you have no idea what they are for or what functions they provide. In all likelihood, specifying that mysqlclient.lib library (which looks like a static library to me) messes up the linker in finding the subsequent functions in libmysql.lib.

I took this simple program, and was able to build it with no issues with Visual Studio 2008:

I specified the lib directory in the Additional Directories, and specified libmysql.lib in the Linker -> Input section. I did nothing else except start the build, and it built successfully the first time I tried it.

Re: MySQL and C++ lib error

Originally Posted by Paul McKenzie

Do not add mysqlclient.lib.

The functions you're calling are within the libmysql.dll module, therefore the library that you should be linking to is libmysql.lib. Don't add libraries that you have no idea what they are for or what functions they provide. In all likelihood, specifying that mysqlclient.lib library (which looks like a static library to me) messes up the linker in finding the subsequent functions in libmysql.lib.

I took this simple program, and was able to build it with no issues with Visual Studio 2008:

I specified the lib directory in the Additional Directories, and specified libmysql.lib in the Linker -> Input section. I did nothing else except start the build, and it built successfully the first time I tried it.

Regards,

Paul McKenzie

I actually had ONLY libmysql.lib there - if you look at original post, I never mentioned mysqlclient - I just added it after I was looking for debug folder and noticed there's mysqlclient in there, so no, it's not working without mysqlclient and libmysql only neither

Re: MySQL and C++ lib error

Originally Posted by DaigonoYouso

I actually had ONLY libmysql.lib there - if you look at original post, I never mentioned mysqlclient - I just added it after I was looking for debug folder and noticed there's mysqlclient in there, so no, it's not working without mysqlclient and libmysql only neither