MySQL Forums
Forum List  »  Connector/C++

Re: Need help with Makefile for static c++ connector
Posted by: Luis Silva
Date: September 21, 2021 04:46AM

The packages might have influence, since it can be built with different/imcompatible g++ version / std++ lib.
So you should use the ubuntu 20.04 package.

With them installed on system, this Makefile works:

root@adcae8f97ae7:~/build# cat Makefile
CC = g++

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

CPPFLAGS = -DCPPCONN_PUBLIC_FUNC= -I /usr/include/mysql-cppconn-8/

LDFLAGS = -lmysqlcppconn-static -lssl -lcrypto -lpthread -ldl -lresolv

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

$(TARGET) : $(OBJECTS)
$(CC) $(CPPFLAGS) ${CPPFLAGS} -o $@ $^ $(LDFLAGS)

.PHONY: clean

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

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Need help with Makefile for static c++ connector
495
September 21, 2021 04:46AM


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.