Note that there are some explanatory texts on larger screens.

plurals
  1. POErrors trying to link MySQL to a project
    primarykey
    data
    text
    <p>I'm not sure if I should have divided this into two posts... if so, let me know for future reference. For now, there are problems with both static and dynamic linking, and I'll put noticeable text to divide the two.</p> <p>I've looked all over the place and found A LOT of solutions both here and elsewhere that seems to solve the problems for others... but none of these solutions have worked for me.</p> <p>Ahead of time, I downloaded Boost and it didn't seem to come with a library - and make doesn't do anything to the directory it's in (Not a fan of Terminal, but I've had to <code>./configure &amp;&amp; make</code>, <code>make</code> and <code>make install</code> a few things recently; Boost doesn't seem to do anything with any of this).</p> <p>I'm already using SDL and my own static library. MySQL Connector/C++ doesn't require either, of course. It does, however, require Boost.</p> <h1>Static</h1> <p>Originally, I attempted to statically link the MySQL library, but that failed horribly by giving me a long list of errors (109 to be exact - all linkers). I'd prefer static linking if it's possible, so I'll list some of the errors here:</p> <pre class="lang-none prettyprint-override"><code>"std::istream::gcount() const", referenced from: sql::mysql::LongDataSender::operator()(std::istream*) const in libMySQL.a(mysql_prepared_statement.cpp.o) "std::string::find_last_of(char, unsigned long) const", referenced from: sql::mysql::parseUri(sql::SQLString const&amp;, sql::mysql::MySQL_Uri&amp;) in libMySQL.a(mysql_uri.cpp.o) "std::string::find_first_of(char, unsigned long) const", referenced from: sql::mysql::MySQL_ConnectionMetaData::getTablePrivileges(sql::SQLString const&amp;, sql::SQLString const&amp;, sql::SQLString const&amp;) in libMySQL.a(mysql_metadata.cpp.o) "std::string::find(std::string const&amp;, unsigned long) const", referenced from: sql::mysql::MySQL_ConnectionMetaData::getColumnPrivileges(sql::SQLString const&amp;, sql::SQLString const&amp;, sql::SQLString const&amp;, sql::SQLString const&amp;) in libMySQL.a(mysql_metadata.cpp.o) sql::mysql::MySQL_ConnectionMetaData::getIdentifierQuoteString() in libMySQL.a(mysql_metadata.cpp.o) ... sql::SQLString, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_&gt;, std::less&lt;sql::SQLString&gt;, std::allocator&lt;std::pair&lt;sql::SQLString const, boost::variant&lt;int, double, bool, sql::SQLString, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_&gt; &gt; &gt; &gt;&amp;) in libMySQL.a(mysql_connection.cpp.o) ... </code></pre> <p>For statically linking, some of the solutions I've read have included the thoughts of… perhaps the library isn't being linked. One solution recommended linking to libstdc++. These were pretty much the two most widely-claimed solutions, but I'm definitely linking the library and libstdc++ didn't effect the errors at all.</p> <h1>Dynamic</h1> <p>So, when, after close to nine hours of trying to get the static-link errors to go away, I decided to move over to dynamic library... all the linker errors were gone! Content enough, I tried to run it and...</p> <pre class="lang-none prettyprint-override"><code>dyld: Library not loaded: libmysqlcppconn.7.dylib Referenced from: /.../Example.app/Contents/MacOS/Example Reason: image not found </code></pre> <p>... Wonderful. My first instinct was, "Oh, right, I need to copy it into the bundle." So, naturally, I went to check on that. Did it. Ran again. No change. Today, I found a few solutions: Go to the Xcode directory and delete Derived Data folder and try to run it again. No luck. The only solution I didn't try (Because I don't think I can) was changing the install path for the dylib.</p> <p>When I was searching for an answer to the static library issue, one person mentioned that the connector from MySQL's site had this problem, but the (Assumably same) connector from a different site didn't have the issue. Problem: A link wasn't given.</p> <p>Some frequent claimed solutions when these problems come up:</p> <ul> <li>Header path isn't listed in project settings, so the methods being called can't be found.</li> <li>Close Xcode, delete Derived Data in the xCode directory, open project, build.</li> <li>Might be using a 32-bit library on a 64-bit project, or vice versa.</li> <li>Dynamic library isn't being copied to the bundle.</li> <li>Library isn't in the link list.</li> <li>Should clean and then build.</li> </ul> <p>Now... out of this list, I've checked to make sure they're all as correct as I know how to get them, and as mentioned earlier, I've already downloaded Boost. Yes, I've made sure the header and lib paths are included in the project settings, same with MySQL's.</p> <p>... Anyone have ANY idea what the deal might be? I've also started a brand new Cocoa project and attempted to get MySQL to work with just connecting to a database and nothing else, and the results are the same (Static and dynamic both).</p> <p>I’m using Mountain Lion and Xcode 4.6.2.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload