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:

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


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

SOURCES = main.c
TARGET = mysqltest

$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)

.PHONY: clean

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

Options: ReplyQuote

Written By
Need help with Makefile for static c++ connector
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.