1

The actual error is a linker error. Undefined reference to get_driver_instance.

Any ideas what the problem is?

This is what I did to install.

Logan Murphy
  • 6,120
  • 3
  • 24
  • 42
  • possible duplicate of [MySQL C++ Connector: undefined reference to \`get\_driver\_instance'](http://stackoverflow.com/questions/3872388/mysql-c-connector-undefined-reference-to-get-driver-instance) – xaxxon Jul 31 '13 at 02:27
  • Why did you tag this with c? – xaxxon Jul 31 '13 at 02:27
  • It is c because c++ is built on c and could potentially be a c directive I am missing. This is not a duplicate because that post (already viewed) did not solve my problem. Nor did many different Google searches. Thank you though. – Logan Murphy Jul 31 '13 at 03:09
  • why don't you post a runnable sample that demonstrates the problem – xaxxon Jul 31 '13 at 04:04
  • I posted my exact process in the original post...maybe you can tell me what I missed or did wrong based on that. – Logan Murphy Jul 31 '13 at 04:23
  • What cppconn package are you downloading exactly? There are probably 50 total.. one of the windows ones? or building it from scratch? – xaxxon Jul 31 '13 at 05:19

1 Answers1

3

It's likely in a namespace.

throw in this and see what happens:

using namespace sql::mysql; 

edit: Also, did you look through the approximately 869 other times people have asked this same question on stack overflow before posting?

https://www.google.com/search?q=mysql+get_driver_instance+site:stackoverflow.com

If that isn't it, it can be a problem with c++ name mangling.

https://en.wikipedia.org/wiki/Name_mangling#Name_mangling_in_C.2B.2B

Because the name-mangling systems for such features are not standardized across compilers, few linkers can link object code that was produced by different compilers.

and I think the final answer is here:

http://www.mingw.org/wiki/MixingCompilers

another stack overflow answer saying this:

What problems can appear when using G++ compiled DLL (plugin) in VC++ compiled application?

You'll need to build the connector from source using your g++ compiler:

http://dev.mysql.com/doc/refman/5.1/en/connector-cpp-installation-source.html

Community
  • 1
  • 1
xaxxon
  • 19,189
  • 5
  • 50
  • 80
  • I have tried this already and the first 2 results in the provided Google search I have already looked at. – Logan Murphy Jul 31 '13 at 03:06
  • So, at this point, I'm thinking it's a c++ compilation issue. If you look in mysql_driver.cpp, it's not in an extern C section, so my understanding is if you're not using the same C++ compiler as they do, it's not going to find the same library because of how it mangles the names. – xaxxon Jul 31 '13 at 05:22
  • Well this I beleive. I looked around a little bit but I cannot find *.cpp files to compile. All I can find is *.h. Any idea where I can find the *.cpp files (I prefer not to use CMAKE since I have been using MinGW / G++ so far). – Logan Murphy Jul 31 '13 at 17:08
  • 1
    @LoganMurphy in the mysql connector download page drop down, select the one called "source" or something. I grabbed it and I have a bunch of cpp files. The file you're looking for is: mysql-connector-c++-1.1.3.tar.gz and there are 110 .cpp files in it. – xaxxon Jul 31 '13 at 19:08