MySQL Forums
Forum List  »  Connector/C++

Need help with Makefile for static c++ connector
Posted by: Ian James
Date: September 06, 2021 04:22PM

I've been trying to compile a c++ program that will be run off of shared linux server I have with Bluehost. After a lot of difficulty I finally managed to successfully compile the program in linux using a makefile. However, Bluehost doesn't have the c++ connector installed, I don't have sudo privileges, and they won't install it for me. So now I'm trying to compile the program with a static version of the mysql c++ connector. I've tried to follow what is provided here: https://dev.mysql.com/doc/connector-cpp/8.0/en/connector-cpp-apps-general-considerations.html.

I am getting the following error when I try to call make: main.cpp:(.text+0x3ad): undefined reference to `get_driver_instance'

I'm hoping someone here can help sort out my makefile and get this thing working.

This is my makefile:

CC = g++

CFLAGS = -g -Wall -O0 -std=c++17

MYSQL_CONCPP_DIR= .../mysql
CPPFLAGS = -DCPPCONN_PUBLIC_FUNC= -I $(MYSQL_CONCPP_DIR)/include

LDFLAGS = $(MYSQL_CONCPP_DIR)/lib64/libmysqlcppconn8-static.a -lssl -lcrypto -lpthread

SOURCES = main.c
OBJECTS = $(SOURCES:.c=.o)
TARGET = mysqltest

$(TARGET) : $(OBJECTS)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)

.PHONY: clean

clean:
@rm -f $(TARGET) $(OBJECTS) core

Options: ReplyQuote


Subject
Views
Written By
Posted
Need help with Makefile for static c++ connector
957
September 06, 2021 04:22PM


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.