List:MySQL++« Previous MessageNext Message »
From:Michael Sullivan Date:December 2 2007 6:35pm
Subject:Re: Annoying question from a noob
View as plain text  
On Sun, 2007-12-02 at 11:01 -0600, Graham Reitz wrote:
> Hi Michael,
> 
> I think on Linux mysql++ will install in the /usr/local/lib and usr/ 
> local/include directories. I would recommend just downloading it from  
> the main site and follow the directions in the README.unix file.  The  
> mysqlpp make install is fairly harmless.
> 
> As far as linking goes.   Make sure that you have the -L /mysqlpp/link/ 
> path as well as the -L /mysqlclient/link/path sent to g++.  Use -lz - 
> lmysqlclient_r -lmysqlpp also and you should be ok for linking (small  
> "el").  It also looks like the header paths are not set up right.  You  
> will need -I /path/to/mysqlpp/headers (that's a capital "eye").
> 
> I think that it's.
> 
> Good luck,
> graham
> 
> 
> On Dec 2, 2007, at 9:28 AM, Michael Sullivan wrote:
> 
> > I know you'll hate me for this.  I blame my own inexperience and
> > ignorance for having to ask this here, but I can't figure out how to
> > link to mysql++ library.  I emerged mysql++ on my Gentoo system.  I
> > cannot figure out where it put the example programs, if it even built
> > them.  I didn't even have the exrun script until I downloaded the  
> > source
> > tarball from the website and built it in my home directory.  I did not
> > do a make install, as that might conflict with the full-system install
> > of the package.  The website said that programs that use mysql++  
> > must be
> > linked with libmysqlpp and libmysqlclient (I did a locate on  
> > mysqlclient
> > and I have mysqlclient_r.so)  Here's the output from my build attempt:
> >
> > michael@camille examples $ g++ simple1.cpp -lmyslpp -lmysqlclient_r
> > In file included from simple1.cpp:28:
> > util.h:31:21: error: mysql++.h: No such file or directory
> > util.h:36: error: expected ',' or '...' before '::' token
> > util.h:36: error: ISO C++ forbids declaration of 'mysqlpp' with no  
> > type
> > util.h:37: error: expected ',' or '...' before '::' token
> > util.h:39: error: ISO C++ forbids declaration of 'mysqlpp' with no  
> > type
> > util.h:40: error: variable or field 'print_stock_rows' declared void
> > util.h:40: error: 'mysqlpp' has not been declared
> > util.h:40: error: 'res' was not declared in this scope
> > util.h:41: error: variable or field 'print_stock_table' declared void
> > util.h:41: error: 'mysqlpp' has not been declared
> > util.h:41: error: 'query' was not declared in this scope
> > util.h:42: error: variable or field 'get_stock_table' declared void
> > util.h:42: error: 'mysqlpp' has not been declared
> > util.h:42: error: 'query' was not declared in this scope
> > util.h:42: error: 'mysqlpp' has not been declared
> > util.h:42: error: 'res' was not declared in this scope
> > util.h:42: error: initializer expression list treated as compound
> > expression
> > util.h:45: error: 'mysqlpp' has not been declared
> > util.h:45: error: expected ',' or '...' before '&' token
> > simple1.cpp: In function 'int main(int, char**)':
> > simple1.cpp:41: error: 'mysqlpp' has not been declared
> > simple1.cpp:41: error: expected `;' before 'con'
> > simple1.cpp:42: error: 'con' was not declared in this scope
> > simple1.cpp:47: error: 'mysqlpp' has not been declared
> > simple1.cpp:47: error: expected `;' before 'query'
> > simple1.cpp:48: error: 'query' was not declared in this scope
> > simple1.cpp:49: error: 'mysqlpp' has not been declared
> > simple1.cpp:49: error: expected `;' before 'res'
> > simple1.cpp:53: error: 'res' was not declared in this scope
> > simple1.cpp:54: error: 'mysqlpp' has not been declared
> > simple1.cpp:54: error: expected `;' before 'row'
> > simple1.cpp:55: error: 'mysqlpp' has not been declared
> > simple1.cpp:55: error: expected `;' before 'i'
> > simple1.cpp:56: error: 'i' was not declared in this scope
> > simple1.cpp:56: error: 'row' was not declared in this scope
> >
> > What am I doing wrong here?

OK.  I've installed it from source and run ldconfig.  It's in /usr/local
now.  When I try to build simple1.cpp however:

michael@camille examples $ g++ simple1.cpp -lz -lmysqlclient_r -lmysqlpp
-I/usr/local/include/mysql++/ -o simple
In file included from /usr/local/include/mysql++/connection.h:38,
                 from /usr/local/include/mysql++/mysql++.h:56,
                 from util.h:31,
                 from simple1.cpp:28:
/usr/local/include/mysql++/common.h:37:27: error: mysql_version.h: No
such file or directory
/usr/local/include/mysql++/common.h:148:19: error: mysql.h: No such file
or directory
/usr/local/include/mysql++/common.h:154: error: 'MYSQL_FIELD' does not
name a type
/usr/local/include/mysql++/connection.h:147: error: 'my_bool' has not
been declared
/usr/local/include/mysql++/connection.h:161: error: expected ',' or
'...' before '&' token
/usr/local/include/mysql++/connection.h:161: error: ISO C++ forbids
declaration of 'MYSQL' with no type
/usr/local/include/mysql++/connection.h:176: error: 'my_bool' has not
been declared
/usr/local/include/mysql++/connection.h:377: error: 'st_mysql_options'
does not name a type
/usr/local/include/mysql++/connection.h:444: error: 'my_ulonglong' does
not name a type
/usr/local/include/mysql++/connection.h:455: error: 'my_ulonglong' does
not name a type
/usr/local/include/mysql++/connection.h:505: error: 'mysql_option' has
not been declared
/usr/local/include/mysql++/connection.h:567: error: 'MYSQL' does not
name a type
/usr/local/include/mysql++/connection.h: In member function 'void
mysqlpp::Connection::close()':
/usr/local/include/mysql++/connection.h:184: error: 'mysql_' was not
declared in this scope
/usr/local/include/mysql++/connection.h:184: error: 'mysql_close' was
not declared in this scope
/usr/local/include/mysql++/connection.h: In member function 'const char*
mysqlpp::Connection::error()':
/usr/local/include/mysql++/connection.h:245: error: 'mysql_' was not
declared in this scope
/usr/local/include/mysql++/connection.h:245: error: 'mysql_error' was
not declared in this scope
/usr/local/include/mysql++/connection.h: In member function 'int
mysqlpp::Connection::errnum()':
/usr/local/include/mysql++/connection.h:252: error: 'mysql_' was not
declared in this scope
/usr/local/include/mysql++/connection.h:252: error: 'mysql_errno' was
not declared in this scope
/usr/local/include/mysql++/connection.h: In member function 'int
mysqlpp::Connection::refresh(unsigned int)':
/usr/local/include/mysql++/connection.h:264: error: 'mysql_' was not
declared in this scope
/usr/local/include/mysql++/connection.h:264: error: 'mysql_refresh' was
not declared in this scope
/usr/local/include/mysql++/connection.h: In member function 'int
mysqlpp::Connection::kill(long unsigned int)':
/usr/local/include/mysql++/connection.h:287: error: 'mysql_' was not
declared in this scope
/usr/local/include/mysql++/connection.h:287: error: 'mysql_kill' was not
declared in this scope
/usr/local/include/mysql++/connection.h: In member function 'std::string
mysqlpp::Connection::client_info()':
/usr/local/include/mysql++/connection.h:295: error:
'mysql_get_client_info' was not declared in this scope
/usr/local/include/mysql++/connection.h: In member function 'std::string
mysqlpp::Connection::host_info()':
/usr/local/include/mysql++/connection.h:306: error: 'mysql_' was not
declared in this scope
/usr/local/include/mysql++/connection.h:306: error:
'mysql_get_host_info' was not declared in this scope
/usr/local/include/mysql++/connection.h: In member function 'int
mysqlpp::Connection::proto_info()':
/usr/local/include/mysql++/connection.h:315: error: 'mysql_' was not
declared in this scope
/usr/local/include/mysql++/connection.h:315: error:
'mysql_get_proto_info' was not declared in this scope
/usr/local/include/mysql++/connection.h: In member function 'std::string
mysqlpp::Connection::server_info()':
/usr/local/include/mysql++/connection.h:323: error: 'mysql_' was not
declared in this scope
/usr/local/include/mysql++/connection.h:323: error:
'mysql_get_server_info' was not declared in this scope
/usr/local/include/mysql++/connection.h: In member function 'std::string
mysqlpp::Connection::stat()':
/usr/local/include/mysql++/connection.h:334: error: 'mysql_' was not
declared in this scope
/usr/local/include/mysql++/connection.h:334: error: 'mysql_stat' was not
declared in this scope
/usr/local/include/mysql++/fields.h: At global scope:
/usr/local/include/mysql++/fields.h:44: error: 'Field' was not declared
in this scope
/usr/local/include/mysql++/fields.h:44: error: template argument 2 is
invalid
/usr/local/include/mysql++/fields.h:44: error: template argument 3 is
invalid
/usr/local/include/mysql++/fields.h:57: error: ISO C++ forbids
declaration of 'Field' with no type
/usr/local/include/mysql++/fields.h:57: error: expected ';' before '&'
token
/usr/local/include/mysql++/fields.h:60: error: ISO C++ forbids
declaration of 'Field' with no type
/usr/local/include/mysql++/fields.h:60: error: expected ';' before '&'
token
/usr/local/include/mysql++/fields.h:65: error: expected `;' before
'size_type'
/usr/local/include/mysql++/fields.h:65: error: 'size_type' does not name
a type
/usr/local/include/mysql++/type_info.h:144: error: expected `)' before
't'
/usr/local/include/mysql++/type_info.h:154: error: expected ',' or '...'
before '&' token
/usr/local/include/mysql++/type_info.h:154: error: ISO C++ forbids
declaration of 'MYSQL_FIELD' with no type
/usr/local/include/mysql++/type_info.h:316: error: 'enum_field_types'
has not been declared
/usr/local/include/mysql++/type_info.h: In constructor
'mysqlpp::mysql_type_info::mysql_type_info(int)':
/usr/local/include/mysql++/type_info.h:155: error: 'f' was not declared
in this scope
/usr/local/include/mysql++/type_info.h:157: error: 'UNSIGNED_FLAG' was
not declared in this scope
/usr/local/include/mysql++/type_info.h:158: error: 'NOT_NULL_FLAG' was
not declared in this scope
/usr/local/include/mysql++/row.h: At global scope:
/usr/local/include/mysql++/row.h:69: error: expected ',' or '...' before
'&' token
/usr/local/include/mysql++/row.h:70: error: ISO C++ forbids declaration
of 'MYSQL_ROW' with no type
/usr/local/include/mysql++/result.h:80: error: expected `)' before '*'
token
/usr/local/include/mysql++/result.h:98: error: ISO C++ forbids
declaration of 'MYSQL_RES' with no type
/usr/local/include/mysql++/result.h:98: error: expected ';' before '*'
token
/usr/local/include/mysql++/result.h:107: error: expected `;' before
'Row'
/usr/local/include/mysql++/result.h:137: error: ISO C++ forbids
declaration of 'Field' with no type
/usr/local/include/mysql++/result.h:137: error: expected ';' before '&'
token
/usr/local/include/mysql++/result.h:143: error: expected `;' before
'void'
/usr/local/include/mysql++/result.h:296: error: ISO C++ forbids
declaration of 'Field' with no type
/usr/local/include/mysql++/result.h:296: error: expected ';' before '&'
token
/usr/local/include/mysql++/result.h:303: error: expected `;' before
'bool'
/usr/local/include/mysql++/result.h:317: error: ISO C++ forbids
declaration of 'MYSQL_RES' with no type
/usr/local/include/mysql++/result.h:317: error: expected ';' before '*'
token
/usr/local/include/mysql++/result.h: In constructor
'mysqlpp::ResUse::ResUse()':
/usr/local/include/mysql++/result.h:71: error: class 'mysqlpp::ResUse'
does not have any field named 'result_'
/usr/local/include/mysql++/result.h: In copy constructor
'mysqlpp::ResUse::ResUse(const mysqlpp::ResUse&)':
/usr/local/include/mysql++/result.h:88: error: 'const class
mysqlpp::ResUse' has no member named 'result_'
/usr/local/include/mysql++/result.h: In member function 'mysqlpp::Row
mysqlpp::ResUse::fetch_row()':
/usr/local/include/mysql++/result.h:109: error: 'result_' was not
declared in this scope
/usr/local/include/mysql++/result.h:117: error: 'MYSQL_ROW' was not
declared in this scope
/usr/local/include/mysql++/result.h:117: error: expected `;' before
'row'
/usr/local/include/mysql++/result.h:118: error: 'result_' was not
declared in this scope
/usr/local/include/mysql++/result.h:118: error: 'mysql_fetch_lengths'
was not declared in this scope
/usr/local/include/mysql++/result.h:119: error: 'row' was not declared
in this scope
/usr/local/include/mysql++/result.h:127: error: 'row' was not declared
in this scope
/usr/local/include/mysql++/result.h: In member function 'long unsigned
int* mysqlpp::ResUse::fetch_lengths() const':
/usr/local/include/mysql++/result.h:133: error: 'result_' was not
declared in this scope
/usr/local/include/mysql++/result.h:133: error: 'mysql_fetch_lengths'
was not declared in this scope
/usr/local/include/mysql++/result.h: In member function 'void
mysqlpp::ResUse::field_seek(int)':
/usr/local/include/mysql++/result.h:145: error: 'result_' was not
declared in this scope
/usr/local/include/mysql++/result.h:145: error: 'mysql_field_seek' was
not declared in this scope
/usr/local/include/mysql++/result.h: In member function 'int
mysqlpp::ResUse::num_fields() const':
/usr/local/include/mysql++/result.h:151: error: 'result_' was not
declared in this scope
/usr/local/include/mysql++/result.h:151: error: 'mysql_num_fields' was
not declared in this scope
/usr/local/include/mysql++/result.h: In member function 'void
mysqlpp::ResUse::purge()':
/usr/local/include/mysql++/result.h:167: error: 'result_' was not
declared in this scope
/usr/local/include/mysql++/result.h:168: error: 'mysql_free_result' was
not declared in this scope
/usr/local/include/mysql++/result.h: In member function
'mysqlpp::ResUse::operator bool() const':
/usr/local/include/mysql++/result.h:196: error: 'result_' was not
declared in this scope
/usr/local/include/mysql++/result.h: In member function 'bool
mysqlpp::ResUse::operator==(const mysqlpp::ResUse&) const':
/usr/local/include/mysql++/result.h:305: error: 'result_' was not
declared in this scope
/usr/local/include/mysql++/result.h:305: error: 'const class
mysqlpp::ResUse' has no member named 'result_'
/usr/local/include/mysql++/result.h: In member function 'bool
mysqlpp::ResUse::operator!=(const mysqlpp::ResUse&) const':
/usr/local/include/mysql++/result.h:312: error: 'result_' was not
declared in this scope
/usr/local/include/mysql++/result.h:312: error: 'const class
mysqlpp::ResUse' has no member named 'result_'
/usr/local/include/mysql++/result.h: At global scope:
/usr/local/include/mysql++/result.h:353: error: expected `)' before '*'
token
/usr/local/include/mysql++/result.h:398: error: 'my_ulonglong' does not
name a type
/usr/local/include/mysql++/result.h: In member function 'const
mysqlpp::Row mysqlpp::Result::fetch_row() const':
/usr/local/include/mysql++/result.h:376: error: 'result_' was not
declared in this scope
/usr/local/include/mysql++/result.h:384: error: 'MYSQL_ROW' was not
declared in this scope
/usr/local/include/mysql++/result.h:384: error: expected `;' before
'row'
/usr/local/include/mysql++/result.h:385: error: 'result_' was not
declared in this scope
/usr/local/include/mysql++/result.h:385: error: 'mysql_fetch_lengths'
was not declared in this scope
/usr/local/include/mysql++/result.h:386: error: 'row' was not declared
in this scope
/usr/local/include/mysql++/result.h:394: error: 'row' was not declared
in this scope
/usr/local/include/mysql++/result.h: In member function 'void
mysqlpp::Result::data_seek(mysqlpp::uint) const':
/usr/local/include/mysql++/result.h:409: error: 'result_' was not
declared in this scope
/usr/local/include/mysql++/result.h:409: error: 'mysql_data_seek' was
not declared in this scope
/usr/local/include/mysql++/result.h: In member function 'virtual
unsigned int mysqlpp::Result::size() const':
/usr/local/include/mysql++/result.h:415: error: 'num_rows' was not
declared in this scope
/usr/local/include/mysql++/result.h: In member function 'unsigned int
mysqlpp::Result::rows() const':
/usr/local/include/mysql++/result.h:421: error: 'num_rows' was not
declared in this scope
/usr/local/include/mysql++/result.h: At global scope:
/usr/local/include/mysql++/result.h:455: error: 'my_ulonglong' does not
name a type
/usr/local/include/mysql++/result.h:456: error: 'my_ulonglong' does not
name a type
/usr/local/include/mysql++/query.h:690: error: 'my_ulonglong' does not
name a type
/usr/local/include/mysql++/query.h:691: error: 'my_ulonglong' does not
name a type
/usr/local/include/mysql++/query.h: In member function 'void
mysqlpp::Query::storein_sequence(Sequence&, const char*)':
/usr/local/include/mysql++/query.h:722: error: 'MYSQL_ROW' was not
declared in this scope
/usr/local/include/mysql++/query.h:722: error: expected `;' before 'd'
/usr/local/include/mysql++/query.h:723: error: 'd' was not declared in
this scope
/usr/local/include/mysql++/query.h:725: error: 'd' was not declared in
this scope
/usr/local/include/mysql++/query.h:725: error: 'class mysqlpp::ResUse'
has no member named 'raw_result'
/usr/local/include/mysql++/query.h:725: error: there are no arguments to
'mysql_fetch_lengths' that depend on a template parameter, so a
declaration of 'mysql_fetch_lengths' must be available
/usr/local/include/mysql++/query.h:725: error: (if you use
'-fpermissive', G++ will accept your code, but allowing the use of an
undeclared name is deprecated)
/usr/local/include/mysql++/query.h: In member function 'void
mysqlpp::Query::storein_set(Set&, const char*)':
/usr/local/include/mysql++/query.h:747: error: 'MYSQL_ROW' was not
declared in this scope
/usr/local/include/mysql++/query.h:747: error: expected `;' before 'd'
/usr/local/include/mysql++/query.h:748: error: 'd' was not declared in
this scope
/usr/local/include/mysql++/query.h:750: error: 'd' was not declared in
this scope
/usr/local/include/mysql++/query.h:750: error: 'class mysqlpp::ResUse'
has no member named 'raw_result'
/usr/local/include/mysql++/query.h:750: error: there are no arguments to
'mysql_fetch_lengths' that depend on a template parameter, so a
declaration of 'mysql_fetch_lengths' must be available

libmysqlclient_r.so is in /usr/lib, so I shouldn't have to explicitly
list that on the command line, should I?

Thread
Annoying question from a noobMichael Sullivan2 Dec
  • Re: Annoying question from a noobGraham Reitz2 Dec
    • Re: Annoying question from a noobMichael Sullivan2 Dec
      • Re: Annoying question from a noobddneilson2 Dec
      • Re: Annoying question from a noobWilliam F. Dowling2 Dec
        • Re: Annoying question from a noobMichael Sullivan2 Dec
          • Re: Annoying question from a noobGraham Reitz2 Dec
          • Re: Annoying question from a noobWarren Young3 Dec
            • Re: Annoying question from a noobKun Niu3 Dec
              • Re: Annoying question from a noobWarren Young3 Dec