- 论坛徽章:
- 0
|
devcpp的包管理器我没搜到
干脆我又在vc中编译了一下
源码:
// ckient1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#define def_host_name NULL
#define def_user_name NULL
#define def_password NULL
#define def_db_name NULL
MYSQL *conn;
int main(int argc, char* argv[])
{
conn=mysql_init(NULL);
mysql_real_connect(
conn,
def_host_name,
def_user_name,
def_password,
def_db_name,
0,
NULL,
0);
mysql_close(conn);
printf("Hello World!\n");
return 0;
}
编译输出:
ompiling...
ckient1.cpp
C:\Program Files\Microsoft Visual Studio\MyProjects\client1\ckient1\ckient1.cpp(10) : error C2143: syntax error : missing ';' before '*'
C:\Program Files\Microsoft Visual Studio\MyProjects\client1\ckient1\ckient1.cpp(10) : error C2501: 'MYSQL' : missing storage-class or type specifiers
C:\Program Files\Microsoft Visual Studio\MyProjects\client1\ckient1\ckient1.cpp(10) : error C2501: 'conn' : missing storage-class or type specifiers
C:\Program Files\Microsoft Visual Studio\MyProjects\client1\ckient1\ckient1.cpp(15) : error C2065: 'mysql_init' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\MyProjects\client1\ckient1\ckient1.cpp(15) : error C2440: '=' : cannot convert from 'int' to 'int *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
C:\Program Files\Microsoft Visual Studio\MyProjects\client1\ckient1\ckient1.cpp(16) : error C2065: 'mysql_real_connect' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\MyProjects\client1\ckient1\ckient1.cpp(25) : error C2065: 'mysql_close' : undeclared identifier
Error executing cl.exe.
ckient1.exe - 7 error(s), 0 warning(s)
我已经下载并安装了 mysql-noinstall-5.1.11-beta-win32
从安装目录得到了include目录和lib目录下的文件并复制到了vc++的INCLUDE目录和LIB目录
并在project->settings和tool->options中设置了
就是过不去呀? |
|