Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / MySQL functions Can't run with wxWindows?

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. MySQL functions Can't run with wxWindows?
#3104
Posted by: mooncake 2003-12-18 21:42:13
Hi,
    I can compile it with console mode, but, i can't compile it with wxWindows?

it always prompt me this error message:

116 C:HomeCompilerDev-Cppincludemysqlmysql_com.h
'SOCKET' is used as a

180 C:HomeCompilerDev-Cppincludemysqlmysql_com.h
`SOCKET' was not

180 C:HomeCompilerDev-Cppincludemysqlmysql_com.h
parse error before `,'

main error focus on:

my_socket fd;                /* For Perl DBI/dbd */
struct sockaddr;
int my_connect(my_socket s, const struct sockaddr *name, unsigned int namelen,
          unsigned int timeout);

what happen?  Is that can't use mySQL functions in wxWindows?

Thank you.

Meow~
Message2. Re: MySQL functions Can't run with wxWindows?
#3106
Posted by: upCASE 2003-12-19 05:46:59
Hi!
Please post your full compile log next time. "'SOCKET' is used as a" is not a very detailed information :)
Maybe set -fmessage-length=0 as a general compiler option so that the errors and warnings don't get cutted.

Judging from the errors I'd say that it's a problem how my_socket was defined. Under Windows where _WIN32 is defined it is SOCKET. This seems to cause an error when using with wxWindows. I tried the following and it seems to work:
1. Open mysql.h
2. Find line 49 (#ifdef __WIN__)
3. Change it to #if (defined(__WIN__) && !defined(__GNUWIN32__))
4. See that __GUNWIN32__ is defined in your compiler options (-D__GNUWIN32__)
5. link to libmysql.a as usual.

As I said I ran some simple test (init - connect - error message - else close connection) and it seems to work. This is surely not the best way to do it. I'm open to any suggestions (maybe using namespaces would be better?).

upcase
upCASE
-----------------------------------
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Message3. Re: MySQL functions Can't run with wxWindows?
#3112
Posted by: mooncake 2003-12-19 20:07:19
it gonna ok now, coz i change my_socket s to sockaddr s

is that mysql functions only have fetch_row and no have fetch_array?

becuase, i dont like to use like this:  row[0] to get the data, and i want to pass the data field and get the data....

Thank you...

Meow~
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Sat 2023-2-4  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0