FAQ
Hi,

I've been using MySQL++ 3.1.0 for a while now and it has been worked great!
But, I have realized, my includes are a mess and when I try to change
those, a bunch of warnings shows up with g++. I'm using 64bit Ubuntu 10.04,
but I have to port my program for i386 FreeBSD and that's where I ran in to
problems.

My MySQL++ 3.1.0 library lies at /usr/include/ and at /usr/lib/. I had some
kind of problems, when I compiled it by myself and succeeded only with
those paths. I had to compile it by myself, because I have a table with 71
columns.

I made an example code to represent the problem. My makefile is as follows:


### M A K E F I L E ###

#Compiler
CC=g++
#Compiler options
CCFLAGS=-std=c++98 -Wall -pedantic -Wextra -g -pthread

#MySQL libs
INC = -I/usr/include/mysql -I/usr/include/mysql++
LIB = -Bsymbolic-functions -rdynamic -L/usr/lib/mysql++ -lmysqlclient
-lmysqlpp

#Sources
SRC=test.cc
#Objects, made from sources
OBJ=$(SRC:.cc=.o)

#The compiled program
MAIN=testprog

all: $(MAIN) $(SRC)

.cc.o:
$(CC) $(CCFLAGS) $(INC) -c -o $@ $<

$(MAIN): $(OBJ)
$(CC) $(CCFLAGS) $(LIB) -o $@ $(OBJ)

clean:
rm -f $(MAIN) $(OBJ)


-I arguments are pointing to the /usr/X locations. And here is the code,
which produces the errros:

###
//MySQL++ includes
#include <mysql++.h>
#include <ssqls.h>
#include <connection.h>
#include <query.h>

int main()
{
return 1;
}

Search Discussions

  • Ina J. at Mar 14, 2012 at 1:55 pm
    Sorry for that. Don't know what button did I hit, but Gmail just sent the
    message. Continuing with the problem.

    g++ gives me this when I try to make the code:

    In file included from test.cc:3:
    /usr/include/mysql++/ssqls.h:38:44: warning: anonymous variadic macros were
    introduced in C99
    In file included from /usr/include/mysql++/connection.h:38,
    from /usr/include/mysql++/mysql++.h:56,
    from test.cc:2:
    /usr/include/mysql++/common.h:158: warning: ISO C++ 1998 does not support
    'long long'
    /usr/include/mysql++/common.h:159: warning: ISO C++ 1998 does not support
    'long long'
    In file included from /usr/include/mysql++/common.h:189,
    from /usr/include/mysql++/connection.h:38,
    from /usr/include/mysql++/mysql++.h:56,
    from test.cc:2:
    /usr/include/mysql/mysql.h:132: warning: ISO C++ 1998 does not support
    'long long'
    In file included from /usr/include/mysql++/row.h:33,
    from /usr/include/mysql++/result.h:40,
    from /usr/include/mysql++/query.h:37,
    from /usr/include/mysql++/mysql++.h:58,
    from test.cc:2:
    /usr/include/mysql++/mystring.h:70: warning: ISO C++ 1998 does not support
    'long long'
    /usr/include/mysql++/mystring.h:72: warning: ISO C++ 1998 does not support
    'long long'
    /usr/include/mysql++/mystring.h:76: warning: ISO C++ 1998 does not support
    'long long'
    /usr/include/mysql++/mystring.h:78: warning: ISO C++ 1998 does not support
    'long long'
    g++ -std=c++98 -Wall -pedantic -Wextra -g -pthread -Bsymbolic-functions
    -rdynamic -L/usr/lib/mysql++ -lmysqlclient -lmysqlpp -o testprog test.o


    Obviously, the program compiles and those are just warnings, but on FreeBSD
    the compiler exists when a warning comes ahead and I don't like warnings
    either.

    But here is the strange part: When I change the includes as follows:

    //MySQL++ includes
    #include <mysql++/mysql++.h>
    #include <mysql++/ssqls.h>
    #include <mysql++/connection.h>
    #include <mysql++/query.h>

    The g++ output is:
    g++ -std=c++98 -Wall -pedantic -Wextra -g -pthread -I/usr/include/mysql
    -I/usr/include/mysql++ -c -o test.o test.cc
    g++ -std=c++98 -Wall -pedantic -Wextra -g -pthread -Bsymbolic-functions
    -rdynamic -L/usr/lib/mysql++ -lmysqlclient -lmysqlpp -o testprog test.o

    Why does it compile without warnings??


    So I've been using the library all the time with the "mysql++"-path prefix
    on Ubuntu. The very same includes doesn't work on FreeBSD and g++ gives
    those 'long long' warnings and exits. Then I tried to reproduce the problem
    with my Ubuntu and figured out that by removing the prefixes, the result is
    the same.

    If I can solve the warnings with Ubuntu I can figure the rest out by myself
    with FreeBSD, but now I'm so confused I have to ask for help.

    -Ina
  • Jonathan Wakely at Mar 14, 2012 at 1:59 pm

    On 14 March 2012 13:55, Ina J. wrote:
    g++ gives me this when I try to make the code:
    [...]

    All those warnings are because you're using -pedantic
    But here is the strange part: When I change the includes as follows:

    //MySQL++ includes
    #include <mysql++/mysql++.h>
    #include <mysql++/ssqls.h>
    #include <mysql++/connection.h>
    #include <mysql++/query.h>

    The g++ output is:
    g++ -std=c++98 -Wall -pedantic -Wextra -g -pthread -I/usr/include/mysql
    -I/usr/include/mysql++ -c -o  test.o test.cc
    g++ -std=c++98 -Wall -pedantic -Wextra -g -pthread -Bsymbolic-functions
    -rdynamic -L/usr/lib/mysql++ -lmysqlclient -lmysqlpp -o testprog test.o

    Why does it compile without warnings??
    Because now the compiler finds the header <XXX.h> at
    /usr/include/XXX.h and that means GCC considers it a system header, so
    suppresses warnings.

    You can make the warnings always happen with -Wsystem-headers, or make
    them never happen by not using -pedantic

    --
    MySQL++ Mailing List
    For list archives: http://lists.mysql.com/plusplus
    To unsubscribe: http://lists.mysql.com/plusplus

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupplusplus @
categoriesmysql
postedMar 14, '12 at 1:41p
activeMar 14, '12 at 1:59p
posts3
users2
websitemysql.com
irc#mysql

2 users in discussion

Ina J.: 2 posts Jonathan Wakely: 1 post

People

Translate

site design / logo © 2022 Grokbase