MySQL Forums
Forum List  »  Connector/C++

Re: Need help with Makefile for static c++ connector
Posted by: Ian James
Date: September 18, 2021 07:21PM

Luis,

Thank you so much for replying to my thread. I appreciate your willingness to assist. Before posting, I had tried a lot of different things, and ultimately decided to seek forum help when they weren't working. At that point, I attempted to restore my makefile to its most basic state, based on the documentation on the MySQL website. It looks like I restored a piece incorrectly and grabbed the wrong library there. Aside from that errant "8", everything else was correct.

After your suggestions I have jumped back in, removed that "8", and then I tried to add "-DSTATIC_CONCPP" as you recommended. I wasn't sure where to put, it however, so I tried a few different places. If you look at my makefile here are the areas I put it: 1: At the end of the line for "CFLAGS" (so just after "-std=c++17". 2: At the beginning of the line for "CPPFLAGS", so in between the "=" and "-DCPPCONN_PUBLIC_FUNC=". 3: At the beginning of the line for "LDFLAGS" so in between the "=" and "${MYSQL_CONCPP_DIR)...".

Trying each separately, I always come back with the exact same result:

main.cpp:(.text+0x3ad): undefined reference to `sql::mysql::get_driver_instance()'
collect2: error: ld returned 1 exit status
make: *** [Makefile:38: mysqltest] Error 1


I'd like to note that when I add to the "LDFLAGS" line "-lmysqlcppconn", then everything works. So its not the c code, its something not being found when trying to link this static library. I can post my makefile again if that's helpful, I just have no idea why the shared library works but the static file just won't.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Need help with Makefile for static c++ connector
549
September 18, 2021 07:21PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.