despite having developed applications in C++ for about two to three years, I never had to setup a project on my own.
Because I knew I wanted to store information in a database,I set off to create a simple CMake project with one executable linked to the MySQL Connector for C++, and instantly failed...
Since I - oddly - could not find helpful information anywhere else, I hope one of you could be my savior.
Do you still use libmysqlcppconn-static.a instead of libmysqlcppconn8-static.a? This was noted in the comments, and the documents also expand on this.
There are also alot of other variables too like are you 100% sure that you have the right bit's, are you using the exact same clang compiler that built the sql binaries, and are you sure the paths are correct.
Sadly that did not fix it. But I made another big mistake. I used connector-cpp 1.1 code which would not work anyway.
To be sure that I do not have any compiler version issues (I checked and they matched), I switched to building the libs myself.
I got that to work, but I can not link to these library either...
I get:
ignoring file ../libs/libmysqlcppconn8.dylib, file was built for unsupported file format ( 0x62 0x6F 0x6F 0x6B 0x00 0x00 0x00 0x00 0x6D 0x61 0x72 0x6B 0x00 0x00 0x00 0x00 ) which is not the architecture being linked (x86_64): ../libs/libmysqlcppconn8.dylib
Why should I use 32 bit. My system uses 64bit and I see no reason that should not work. Maybe there are cmake flags set in the mysql connector which select a certain compiler oder certain libraries. But I do not know how I could find such and if that is even possible.
From my quick google, it seems obvious that this is a bit problem, I don't doubt that you have 64 bits or that 32 bits or better, but it seems like you may have accidentally downloaded the 32 bit binaries.