FAQ
I successfully installed mysql++-2.0.0 using the
'--includedir=/usr/local/include/mysql++' and
'--with-mysql=/usr/local/mysql' switches (/usr/local/mysql is a sym
link to /usr/local/mysql-standard-4.1.11-apple-darwin7.8.0-powerpc if
that matter at all). I wrote a simple test program:

// Example 1

#include <iostream>
#include <mysql++.h>
#include <manip.h>

using namespace std;
using namespace mysqlpp;

int main() {
Connection con("serverstats", "127.0.0.1", "webdev", "webdevpass");

Query query = con.query();

query << "SELECT * FROM servers";

Result res = query.store();

cout << "Query: " << query.preview() << endl;

cout << "Records found: " << res.size() << endl << endl;

Row row;
cout.setf(ios::left);
cout << setw(17) << "Item"
<< setw(4) << "Num"
<< setw(7) << "Weight"
<< setw(7) << "Price"
<< "Date" << endl << endl;

Result::iterator i;
for(i = res.begin(); i != res.end(); i++) {
row = *i;
cout << setw(17) << row[0]
<< setw(4) << row[1]
<< setw(7) << row[2]
<< setw(7) << row[3]
<< row[4] << endl;
}

return 0;
}

When I try to compile with "g++ example.cpp -o example" I get these errors:

example.cpp:4:22: error: mysql++.h: No such file or directory
example.cpp:5:19: error: manip.h: No such file or directory
example.cpp:8: error: expected namespace-name before ';' token
example.cpp:8: error: '<type error>' is not a namespace
example.cpp: In function 'int main()':
example.cpp:11: error: 'Connection' was not declared in this scope
example.cpp:11: error: expected `;' before 'con'
example.cpp:13: error: 'Query' was not declared in this scope
example.cpp:13: error: expected `;' before 'query'
example.cpp:15: error: 'query' was not declared in this scope
example.cpp:17: error: 'Result' was not declared in this scope
example.cpp:17: error: expected `;' before 'res'
example.cpp:21: error: 'res' was not declared in this scope
example.cpp:23: error: 'Row' was not declared in this scope
example.cpp:23: error: expected `;' before 'row'
example.cpp:25: error: 'setw' was not declared in this scope
example.cpp:31: error: 'Result' is not a class or namespace
example.cpp:31: error: missing template arguments before 'i'
example.cpp:31: error: expected `;' before 'i'
example.cpp:32: error: 'i' was not declared in this scope
example.cpp:33: error: 'row' was not declared in this scope

Looking around it seems that the default place to look for header
files is /usr/include not /usr/local/include so I tried copying the
while mysql++ directory to /usr/include and that did nothing. I also
tried copying the entire contents of the mysql++ directory to
/usr/include and still the same error messages. What am I doing
wrong?

- Brandon

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupplusplus @
categoriesmysql
postedAug 3, '05 at 4:56p
activeAug 3, '05 at 4:56p
posts1
users1
websitemysql.com
irc#mysql

1 user in discussion

Brandon Woodson: 1 post

People

Translate

site design / logo © 2022 Grokbase