Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Error MYSQL.H LineNo Too many types in declaration

0 views
Skip to first unread message

Rubber Ducky

unread,
May 27, 2001, 1:47:26 PM5/27/01
to
Welcome and thanks for the time in reading this. I have a simple proggie
below. When I try and compile it I get the error above (subject) the error
points to this part of mysql.h - the part specifically is highlighted in
red.

I am compiling it on Win2K SP2 with Borland C++ v4.52
I can't see any reason why this wouldn't work. Can you??


I also get 5 warnings:
WARNING MYSQL.CPP LineNo: Temporary used for parameter 1 in call to
'istream::operator >> (int &)' in function main()
- Well seeing as I have a problem anyway it seems silly not to mention it!

<extract from mysql.h>
#if defined(NO_CLIENT_LONG_LONG)
typedef unsigned long my_ulonglong;
#elif defined (__WIN__)
typedef unsigned __int64 my_ulonglong;
#else
typedef unsigned long long my_ulonglong;
#endif
<end of extract>


<CODE>

////////////////////////////////////////////////////////////////////////////
////
// Program: Client proggie to connect to mysql server. Server options are
// specified by the user
// Aim: To retrieve data from table specified by user in Microsoft access
format
// and insert the table into a Microsoft access database of the users choice
//
// Command line version of the program currently being investigated
// I.e. c:\this_proggie -h host -u user -p pass -po port
//
// Start of development: 24th May 2001
// Date modified: 27th May 2001
// Author: David Ayliffe
// Version: 0.1
////////////////////////////////////////////////////////////////////////////
////

#include <stdio.h>
#include <iostream.h> // libraries included in the linked (object) file
#include <conio.h>
#include "mysql.h" // include the mysql libraries copied from the win
// source download

#define def_host_name NULL /*host to connecto to (default localhost) */
#define def_user_name NULL /*user name for the database (default login name)
*/
#define def_password NULL /*password for the database (default is null) */
#define def_db_name NULL /*default database (default database default
none) */
#define def_svr_port NULL /*port to connect to (default 3306) */

MYSQL *conn; /*pointer to the connection handle */

int main ()
{
clrscr();
cout << "Enter the host name (default localhost): ";
cin >> def_host_name;
cout << "Enter the user name (default root): ";
cin >> def_user_name;
cout << "Enter the password (default blank): ";
cin >> def_password;
cout << "Enter the database name (default none): ";
cin >> def_db_name;
cout << "Enter the port (default 3306): ";
cin >> def_db_name;

// the real work starts here

conn = mysql_init (NULL);
mysql_real_connect (
conn, // pointer to connection handle
def_host_name, // host to connect to
def_user_name, // user name to connect as
def_password, // password to use
def_db_name, // database to use
def_svr_port, // port to connect through
NULL, // socket
0); // flags

mysql_close (conn);
return 0;
}

<\CODE>
--
Thanks
Rubber Ducky

Please reply to group or to email
To reply to email remove NOSPAM

Phlip

unread,
May 27, 2001, 2:07:02 PM5/27/01
to
Proclaimed Rubber Ducky from the mountaintops:

> #define def_host_name NULL /*host to connecto to (default localhost) */

> cin >> def_host_name;

Please learn some C++ before diving into a custom library like MySQL.lib.

In this case, you used #define to tell the compiler to replace every
"def_host_name" it sees with "NULL". NULL is typically 0.

Then you say 'cin >> 0', and the compiler goes "wha??".

Read /Accelerate C++/, and then use the 'std::string' object.

--
Phlip phli...@my-deja.com
============== http://phlip.webjump.com ==============
-- Sampling is the sincerest form of flattery --

0 new messages