List:MySQL++« Previous MessageNext Message »
From:Brandon Woodson Date:August 3 2005 4:56pm
Subject:help with mysql++ install on Mac OS 10.4.2
View as plain text  
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
Thread
help with mysql++ install on Mac OS 10.4.2Brandon Woodson3 Aug