MySQL Forums
Forum List  »  Connector/C++

Segmentation Fault on Example Program
Posted by: None Youbusiness
Date: November 19, 2015 09:29PM

I am using Mac OS X Yosemite version 10.10.5. I downloaded the connector/c++ library from the mysql developer website. I untared the files and installed them in /usr/local/mysql-connector-c++-1.1.6-osx10.8-x86-64bit. I created a simple makefile. Everything compiles and links fine, but when I run it, I get a segmentation fault 11. Why?

#locations to library directories
CONNECTOR_C_PATH = /usr/local/mysql-connector-c-6.1.6-osx10.8-x86_64
CONNECTOR_CPP_PATH = /usr/local/mysql-connector-c++-1.1.6-osx10.8-x86-64bit
BOOST_PATH = /usr/local/Cellar/boost/1.58.0

#specific configuration for this build
INCLUDE_PATHS = -I $(CONNECTOR_CPP_PATH)/include -I $(BOOST_PATH)/include
LIB_PATHS = -L $(CONNECTOR_CPP_PATH)/lib -L $(BOOST_PATH)/lib
LIBS = -l mysqlcppconn
COMPILE_OPTS = $(INCLUDE_PATHS) 
LINK_OPTS = $(LIB_PATHS) $(LIBS)
CPP = g++
COMPILE = $(CPP) $(COMPILE_OPTS) -c
LINK = $(CPP) $(LINK_OPTS) -o

all: sqltest

# Create the server
sqltest: main.o 
	 $(LINK) sqltest main.o

main.o: main.cpp
	$(COMPILE) main.cpp

clean:
	-rm *.o sqltest

Options: ReplyQuote


Subject
Views
Written By
Posted
Segmentation Fault on Example Program
1852
November 19, 2015 09:29PM


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.