http://bbs.csdn.net/topics/310257487
这个帖子上已经贴出来了vc 6.0 连接配置mysql的方法,我没有找到帖子中所说的opt文件夹,但是这个帖子中说的版本估计不是5.6,我按照这个贴子中进行配置后,build 时出现如下错误:
--------------------Configuration: PatentData - Win32 Debug--------------------
Compiling resources...
Compiling...
StdAfx.cpp
d:\program files\mysql\mysql server 5.6\include\mysql_com.h(320) : error C2146: syntax error : missing ';' before identifier 'fd'
d:\program files\mysql\mysql server 5.6\include\mysql_com.h(320) : error C2501: 'SOCKET' : missing storage-class or type specifiers
d:\program files\mysql\mysql server 5.6\include\mysql_com.h(320) : error C2501: 'fd' : missing storage-class or type specifiers
Error executing cl.exe.
PatentData.exe - 3 error(s), 0 warning(s)然后百度:http://blog.sina.com.cn/s/blog_5e8782250100nh8a.html 这篇文章说配置有问题,可是我重新配置了很多次还是出现同样问题。请问大牛们,这个问题该如何解决?多谢!!!!!!!!!!!!!!!!!!!!!!!!!
http://dev.mysql.com/doc/connector-cpp/en/connector-cpp-apps-windows-visual-studio.html 这是 mysql 官方给出的基于visual studio 版本使用 
Connector/C++ 进行配置的方法,本人还未尝试,可是我还是想弄懂vc6.0如何连接mysql5.6 多谢了!

解决方案 »

  1.   

    #include <windows.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <stdarg.h>
    #include "mysql.h"去掉stdafx.h, .cpp. 不用预编译生成的这套头文件.在你的实现文件里头添加上边的几个包含.
      

  2.   

    怎么去掉stdafx.h, .cpp啊?我是新手,不好意思,我把#include stdafx.h注释掉了,然后把那两个文件删除了,然后编译出现如下错误:还望大牛指点啊,多谢!--------------------Configuration: testData - Win32 Debug--------------------
    Compiling...
    StdAfx.cpp
    e:\c++ programs\testdata\stdafx.cpp(10) : error C2857: '#include' statement specified with the /Ycstdafx.h command-line option was not found in the source file
    Error executing cl.exe.StdAfx.obj - 1 error(s), 0 warning(s)
      

  3.   

    sigh, 这无非就是一个vc的编译环境的问题,跟mysql一点关系也没有.
    为了简化解决问题的办法,
    那个stdafx.h, 及.cpp都保留吧.
    #include stdafx.h也不要去掉.
    在#include "stdafx.h"这一行的上头加上前几个include:#include <windows.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <stdarg.h>
    #include "mysql.h"然后再编译你的程序.
    你要是将这几个头文件的include放到"stdafx.h"后边,就会出现你报的错.
      

  4.   

    真的非常感谢您的及时回复,我按照您的指导添加后,发现还是出现了这个错误,是不是要安装boost ?testData.cpp
    d:\program files\mysql\connector c++ 1.1.3\include\cppconn\connection.h(31) : fatal error C1083: Cannot open include file: 'boost/variant.hpp': No such file or directory
    Error executing cl.exe.
      

  5.   

    你用C++ connector? 
    那显然要用boost.
    不过,估计你用VC6行不通.
    要是不用c++接口,直接用c api,还可以.
      

  6.   

    非常感谢哈!
    我换成VS2010 + mysql 5.6 然后按照 http://www.cnblogs.com/rolling-stone/p/3373744.html 中的操作进行配置,并其中的例子代码,怎么提示如下错误?还望大牛继续给我指点!多谢了!1>------ 已启动生成: 项目: PatentData, 配置: Debug Win32 ------
    1>生成启动时间为 2014/9/8 18:30:49。
    1>InitializeBuildStatus:
    1>  正在对“Debug\PatentData.unsuccessfulbuild”执行 Touch 任务。
    1>ClCompile:
    1>  所有输出均为最新。
    1>  PatentData.cpp
    1>ResourceCompile:
    1>  所有输出均为最新。
    1>ManifestResourceCompile:
    1>  所有输出均为最新。
    1>PatentData.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: __thiscall sql::SQLString::~SQLString(void)" (__imp_??1SQLString@sql@@QAE@XZ),该符号在函数 "public: __thiscall CPatentDataApp::CPatentDataApp(void)" (??0CPatentDataApp@@QAE@XZ) 中被引用
    1>PatentData.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: __thiscall sql::SQLString::SQLString(char const * const)" (__imp_??0SQLString@sql@@QAE@QBD@Z),该符号在函数 "public: __thiscall CPatentDataApp::CPatentDataApp(void)" (??0CPatentDataApp@@QAE@XZ) 中被引用
    1>PatentData.obj : error LNK2019: 无法解析的外部符号 __imp__get_driver_instance,该符号在函数 "public: __thiscall CPatentDataApp::CPatentDataApp(void)" (??0CPatentDataApp@@QAE@XZ) 中被引用
    1>E:\C++ Programs\PatentData\Debug\PatentData.exe : fatal error LNK1120: 3 个无法解析的外部命令
    1>
    1>生成失败。
    1>
    1>已用时间 00:00:02.97
    ========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========