6 messages in com.mysql.lists.plusplusRe: Can't compile any program using m...| From | Sent On | Attachments |
|---|---|---|
| Magnet | 27 Oct 2003 09:38 | |
| Sinisa Milivojevic | 28 Oct 2003 03:05 | |
| Magnet | 28 Oct 2003 07:10 | |
| Sinisa Milivojevic | 29 Oct 2003 03:00 | |
| Magnet | 29 Oct 2003 08:45 | |
| Sinisa Milivojevic | 31 Oct 2003 02:53 |
| Subject: | Re: Can't compile any program using mySQL++![]() |
|---|---|
| From: | Magnet (mys...@mithrandir.net) |
| Date: | 10/29/2003 08:45:31 AM |
| List: | com.mysql.lists.plusplus |
Sinisa Milivojevic <sin...@beotel.yu> wrote:
Please stick to gcc 3.2. Even better 3.2.2.
Which example you could not compile with it ???
Send us the output from make in examples directory. There should be no errors with supplied Makefile's and examples.
In your own code, please try not to use streams for commands not returning sets. For INSERT take a look at provided examples on how to issue that command.
OK so, I finally got it.
First, my system had become kinda messed up with all of these libs and devel headers. I removed almost everything to end up with gcc2.95 (for backward compatibility) and gcc3.2.3.
I updated my libmysqlclient (which was still 10 and I couldn't compile a bit of code with it) to 12.
Then I started again patching installing mysql++. It worked fine except all these warnings from g++ asking to use vector instead of vector.h and sstream instead of strstream.h. I don't care since it can be avoided with -Wno-deprecated.
I think it would be great if a "working with every g++ version" package was released (getting advantage of the C preprocessor and configure). But I understand if you don't have much time to spare on mysql++ (but its usage is so more pleasant than the common MySQL C API, it would be great). I am not new to Linux and I rarely had so much trouble installing a lib or a daemon.
Anyway, every example did compile and I finally compiled my own test program (a different one but working fine). I successfully connect to a remote mySQL server and can browse into SELECT results.
I still have questions, sorry :). This is about SSQLS. Look at my code :
#include <iostream> #include <vector> #include <mysql.h> #include <sqlplus.hh> #include <custom.hh> #include <stdlib.h> #include <strings.h> #include <string>
sql_create_1(my_ssqls, 0, 0, std::string, item);
int main(int argc, char **argv) { if (argc != 2) { cerr<<"Need 1 arg\n"; exit(1); } MysqlConnection myLink(use_exceptions); if (myLink.real_connect("", "myserv.org", "services", "mypass", 1212, (int)0, 60, 0)) cout <<"Connected"<<endl; else { cout <<"Not connected"<<endl; exit(1); } myLink.select_db("Test");
my_ssqls row; row.set(argv[1]);
MysqlQuery myQuery = myLink.query();
myQuery.insert(row);
cout<<"Query : "<<myQuery.preview()<<endl;
myQuery.execute();
}
I don't use exceptions but it won't compile anyway. I'm getting a lot of errors (all in french so I will just translate the overall error) : Lot of invalid tokens with my_ssqls when it try to concat it with ~, *, ::, etc.. Well, the SSQLS seems not to be working with my compile command option.
I'm using :
g++ -Wno-deprecated -I/usr/include/mysql/ -I/usr/local/include test2.C -o test2 -lmysqlclient -lsqlplus
(and mysql++ headers are in /usr/local/include)
I'm trying not to use a whole Makefile just to compile test programs, but it seems my g++ command isn't good. Please tell me if you've got the proper :).
Any hint will be appreciated :)
-- Magnet




