List:MySQL++« Previous MessageNext Message »
From:Thierry Leveque Date:August 29 2000 5:17pm
Subject:Compilation error...please help!
View as plain text  
Hi

I'm a novice C++ programmer under Linux, and I'm trying to convert some of
my Perl CGI to C++.
I'm using GNU 2.91.66
I have download and successfully compile and install MySql++.1.7.5.
All the header files are in the /usr/local/include directory. (as it should
be....)

This is part of my test code: (main.cpp)

#include <iostream.h>
#include <fstream.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <exception>
#include "cgicc/Cgicc.h"
#include "cgicc/HTMLClasses.h"
#include <iomanip>
#include <sqlplus.hh>

int main(int argc, char **argv)
{
 try {
.....
.....
           //test d'acces de db sql
           Connection con;
           con.connect("mfcore","localhost","dbname","password");
           Query query = con.query();
           query << "select sld,tld,period from domain where tld='net'";
           Result res = query.store();
           cout << "Query: " << query.preview() << "<br>\n";
.....
.....
  }
  catch(exception& e) {
     //
  }

 return 0;
}

And when I try to build it, I've got:

c++  -I/usr/local/include -I/usr/include/mysql  -Wall -W -pedantic -g -O2 -c
main.cpp
/usr/local/include/null1.hh: In method
`MysqlNull<void,MysqlNullisNull>::MysqlNull(const class mysql_null_type &)':
In file included from /usr/local/include/coldata1.hh:9,
                from /usr/local/include/sqlplus.hh:12,
                from main.cpp:23:
/usr/local/include/null1.hh:72: warning: unused parameter `const class
mysql_null_type & n'
/usr/local/include/null1.hh: In method `class
MysqlNull<void,MysqlNullisNull> &
MysqlNull<void,MysqlNullisNull>::operator
=(const class mysql_null_type &)':
/usr/local/include/null1.hh:77: warning: unused parameter `const class
mysql_null_type & n'
/usr/local/include/manip1.hh: In function `struct quote_type1 operator
<<(class ostream &, enum quote_type0)':
In file included from /usr/local/include/vallist1.hh:6,
                from /usr/local/include/row1.hh:11,
                from /usr/local/include/compare1.hh:5,
                from /usr/local/include/sqlplus.hh:13,
                from main.cpp:23:
/usr/local/include/manip1.hh:31: warning: unused parameter `enum quote_type0
esc'
/usr/local/include/manip1.hh: In function `struct quote_type2 operator
<<(class SQLQueryParms &, enum quote_type0)':
/usr/local/include/manip1.hh:40: warning: unused parameter `enum quote_type0
esc'
/usr/local/include/manip1.hh: In function `struct quote_only_type1 operator
<<(class ostream &, enum quote_only_type0)':
/usr/local/include/manip1.hh:105: warning: unused parameter `enum
quote_only_type0 esc'
/usr/local/include/manip1.hh: In function `struct quote_only_type2 operator
<<(class SQLQueryParms &, enum quote_only_type0)':
/usr/local/include/manip1.hh:114: warning: unused parameter `enum
quote_only_type0 esc'
/usr/local/include/manip1.hh: In function `struct quote_double_only_type1
operator <<(class ostream &, enum quote_double_only_type0)':
/usr/local/include/manip1.hh:165: warning: unused parameter `enum
quote_double_only_type0 esc'
/usr/local/include/manip1.hh: In function `struct quote_double_only_type2
operator <<(class SQLQueryParms &, enum quote_double_only_type0)':
/usr/local/include/manip1.hh:175: warning: unused parameter `enum
quote_double_only_type0 esc'
/usr/local/include/manip1.hh: In function `struct escape_type1 operator
<<(class ostream &, enum escape_type0)':
/usr/local/include/manip1.hh:227: warning: unused parameter `enum
escape_type0 esc'
/usr/local/include/manip1.hh: In function `struct escape_type2 operator
<<(class SQLQueryParms &, enum escape_type0)':
/usr/local/include/manip1.hh:236: warning: unused parameter `enum
escape_type0 esc'
/usr/local/include/manip1.hh: In function `struct do_nothing_type1 operator
<<(class ostream &, enum do_nothing_type0)':
/usr/local/include/manip1.hh:273: warning: unused parameter `enum
do_nothing_type0 esc'
/usr/local/include/manip1.hh: In function `struct do_nothing_type2 operator
<<(class SQLQueryParms &, enum do_nothing_type0)':
/usr/local/include/manip1.hh:287: warning: unused parameter `enum
do_nothing_type0 esc'
/usr/local/include/manip1.hh: In function `struct ignore_type2 operator
<<(class SQLQueryParms &, enum ignore_type0)':
/usr/local/include/manip1.hh:303: warning: unused parameter `enum
ignore_type0 esc'
/usr/local/include/string_util.hh: In function `void str_to_upr(class string
&)':
In file included from /usr/local/include/field_names1.hh:10,
                from /usr/local/include/result1.hh:15,
                from /usr/local/include/query1.hh:13,
                from /usr/local/include/connection1.hh:20,
                from /usr/local/include/sqlplus.hh:14,
                from main.cpp:23:
/usr/local/include/string_util.hh:12: warning: ANSI C++ forbids
braced-groups within expressions
/usr/local/include/string_util.hh: In function `void str_to_lwr(class string
&)':
/usr/local/include/string_util.hh:18: warning: ANSI C++ forbids
braced-groups within expressions
/usr/local/include/result1.hh: In method `MysqlRes::MysqlRes(const class
MysqlRes &)':
In file included from /usr/local/include/query1.hh:13,
                from /usr/local/include/connection1.hh:20,
                from /usr/local/include/sqlplus.hh:14,
                from main.cpp:23:
/usr/local/include/result1.hh:159: warning: base class `class
const_subscript_container<MysqlRes,MysqlRow,const MysqlRow,unsigned
int,int>' should be explicitly initialized in the copy constructor
/usr/local/include/convert1.hh: At top level:
In file included from /usr/local/include/sqlplus.hh:16,
                from main.cpp:23:
/usr/local/include/convert1.hh:19: warning: declaration of `strtod(const
char *, char **)' throws different exceptions
/usr/include/stdlib.h:244: warning: previous declaration here
/usr/local/include/convert1.hh:36: warning: declaration of `strtol(const
char *, char **, int)' throws different exceptions
/usr/include/stdlib.h:250: warning: previous declaration here
/usr/local/include/convert1.hh:37: warning: declaration of `strtoul(const
char *, char **, int)' throws different exceptions
/usr/include/stdlib.h:256: warning: previous declaration here
/usr/local/include/convert1.hh:61: warning: declaration of `strtoll(const
char *, char **, int)' throws different exceptions
/usr/include/stdlib.h:292: warning: previous declaration here
/usr/local/include/convert1.hh:62: warning: declaration of `strtoull(const
char *, char **, int)' throws different exceptions
/usr/include/stdlib.h:298: warning: previous declaration here
main.cpp: In function `void replacestr(class string &, class string, class
string)':
main.cpp:37: warning: comparison between signed and unsigned
main.cpp: In function `int main(int, char **)':
main.cpp:53: warning: unused parameter `int argc'
main.cpp:53: warning: unused parameter `char ** argv'
c++ -Wl,-rpath=/usr/local/lib -o /usr/local/apache/cgi-bin/example/test.cgi
main.o -L/usr/local/lib -lcgicc
main.o: In function `main':
/usr/local/include/connection1.hh:41: undefined reference to `mysql_init'
main.o: In function `main':
/home/thierry/testcgi/testcgi/main.cpp:104: undefined reference to
`MysqlConnection::~MysqlConnection(void)'
collect2: ld returned 1 exit status
gmake: *** [/usr/local/apache/cgi-bin/example/test.cgi] Error 1
*** failed ***

Can someone give me a hit about what I'm doing wrong?
Please help

Thierry Lévèque
leveque@stripped
Médiafusion Inc.
1205 av. Papineau, #152
Montreal (Quebec)   H2K 4R2
Tel.  (514) 599-5721
Fax. (514) 599-5729
www.mediafusion.com



Thread
Compilation error...please help!Thierry Leveque29 Aug