Found the problem! It was in my compile options.
My makefile's compile section looked like this:
#Compiler
CC=g++
#Compiler options
CCFLAGS=-std=c++98 -Wall -pedantic -Wextra -g -D_GLIBCXX_DEBUG -pthread
#MySQL libs
MYSQL_INC = -I/usr/include/mysql -I/usr/include/mysql++
MYSQL_LIB = -Bsymbolic-functions -rdynamic -L/usr/lib/mysql++ -lmysqlclient
-lmysqlpp
My makefile had an error in it and it didn't use the CCFLAGS at all at the
beginning of the project. I corrected it during the project and then the
problem occured. When I realized this, I started to cut down the options and
found the 'D_GLIBCXX_DEBUG' will trigger the valgrind. I removed it from my
makefile and everything works as it should now.
Why does this option cause that kind of a problem?? Can't even remember
where I found the option and why did I add it after all.
-Ina
PS. I haven't configured/compiled the MySQL++ library with threads enabled,
but the library isn't used in the threads so can I continue like this or
should I still compile it with the threads enabled flag?? Only the main
program uses the library.