﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-Error-文章分类-MySql</title><link>http://www.cppblog.com/Error/category/17835.html</link><description /><language>zh-cn</language><lastBuildDate>Wed, 28 Sep 2011 05:40:01 GMT</lastBuildDate><pubDate>Wed, 28 Sep 2011 05:40:01 GMT</pubDate><ttl>60</ttl><item><title>MySql  C++ connector</title><link>http://www.cppblog.com/Error/articles/157022.html</link><dc:creator>Enic</dc:creator><author>Enic</author><pubDate>Tue, 27 Sep 2011 16:56:00 GMT</pubDate><guid>http://www.cppblog.com/Error/articles/157022.html</guid><wfw:comment>http://www.cppblog.com/Error/comments/157022.html</wfw:comment><comments>http://www.cppblog.com/Error/articles/157022.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Error/comments/commentRss/157022.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Error/services/trackbacks/157022.html</trackback:ping><description><![CDATA[<div>本来是非常兴致勃勃的来整C++的，，，结果太失望了，，，<br />mysql的C++接口是有bug的，我艹，，，<br />虽然不知道是什么问题，但是对照源代码查看是完全不可能出现的情况，，，遂很伤心，，，折腾大半夜重新编译安装以后解决，，，很伤心，，，<br /><br /><br />配置C接口也遇到一个问题：<br />
<p>c:\program <wbr>files\mysql\mysql <wbr>server <wbr>5.0\include\mysql_com.h(175) <wbr>: <wbr>error <wbr>C2146: <wbr>syntax <wbr>error <wbr>: <wbr>missing <wbr>';' <wbr>before <wbr>identifier <wbr>'fd'<br />c:\program <wbr>files\mysql\mysql <wbr>server <wbr>5.0\include\mysql_com.h(175) <wbr>: <wbr>error <wbr>C2501: <wbr>'SOCKET' <wbr>: <wbr>missing <wbr>storage-class <wbr>or <wbr>type <wbr>specifiers<br />c:\program <wbr>files\mysql\mysql <wbr>server <wbr>5.0\include\mysql_com.h(175) <wbr>: <wbr>error <wbr>C2501: <wbr>'fd' <wbr>: <wbr>missing <wbr>storage-class <wbr>or <wbr>type <wbr>specifiers<br />c:\program <wbr>files\mysql\mysql <wbr>server <wbr>5.0\include\mysql_com.h(339) <wbr>: <wbr>error <wbr>C2065: <wbr>'SOCKET' <wbr>: <wbr>undeclared <wbr>identifier<br />c:\program <wbr>files\mysql\mysql <wbr>server <wbr>5.0\include\mysql_com.h(339) <wbr>: <wbr>error <wbr>C2146: <wbr>syntax <wbr>error <wbr>: <wbr>missing <wbr>')' <wbr>before <wbr>identifier <wbr>'s'<br />c:\program <wbr>files\mysql\mysql <wbr>server <wbr>5.0\include\mysql_com.h(340) <wbr>: <wbr>error <wbr>C2059: <wbr>syntax <wbr>error <wbr>: <wbr>')'<br /><br />等错误</p>
<p><wbr></p>
<p>解决方法：</p>
<p>1. 确定配置正确</p>
<p>1）project--&gt;properties--&gt;configuration properties--&gt;c/c++--&gt;general--&gt;additional include directories中填写"<font color="#ed1c24">C:\Program Files\MySQL\MySQL Server 5.0\include</font>" 红色部分改成你自己安装MySQL时候的路径</p>
<p>2）project--&gt;properties--&gt;configuration properties--&gt;Linker--&gt;General--&gt;additional library directories中填写"<font color="#ed1c24">C:\Program Files\MySQL\MySQL Server 5.0\lib\debug</font>" 红色部分改成你自己安装MySQL时候的路径</p>
<p>3）project--&gt;properties--&gt;configuration properties--&gt;Linker--&gt;input--&gt;additional <wbr>dependencies 中填写 libmysql.lib 把这个文件从mysql的安装目录下copy到C:\WINDOWS\system32目录下.</p>
<p><wbr></p>
<p>2. <wbr>确定在程序的头文件中含有</p>
<p>#include &lt;winsock.h&gt;<br />#include "mysql.h"</p></div><img src ="http://www.cppblog.com/Error/aggbug/157022.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Error/" target="_blank">Enic</a> 2011-09-28 00:56 <a href="http://www.cppblog.com/Error/articles/157022.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>