Quantcast
Channel: MySQL Forums - Connector/C++
Viewing all articles
Browse latest Browse all 527

Need help with Makefile for static c++ connector (no replies)

$
0
0
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

Viewing all articles
Browse latest Browse all 527

Trending Articles