Answer the question
In order to leave comments, you need to log in
C++ Mysql program on win server 2003?
There is a program that should connect to Mysql, the bottom line is that it works fine on win7, and on server2003 it has the same c++ 2010, the same Mysql 5.5, Mysql connector c++, in general, everything is the same, but the program does not compile and swears at the linker -
------ Build Started: Project: bd, Configuration: Release Win32 ------
bd.cpp
bd.obj : error LNK2001: unresolved external symbol "@[email protected]"
bd.obj : error LNK2001: unresolved external symbol "__imp__fprintf"
bd.obj : error LNK2001: unresolved external symbol "__imp____iob_func"
bd.obj : error LNK2001: unresolved external symbol "__imp__system"
LINK : error LNK2001: unresolved external symbol "_wmainCRTStartup"
C:\Documents and Settings\Administrator\my documents\visual studio 2010\Projects\bd\Release\bd.exe : fatal error LNK1120: 5 unresolved externals
========== Build: Success: 0, with errors: 1, unchanged: 0, omitted: 0 =======
in c++ I'm generally new (warm)
here is the code itself
#include "stdafx.h"
#include <iostream>
#include <conio.h>
#include <stdlib.h>
#include<mysql.h>
#include<fstream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
MYSQL *conn;
// Получаем дескриптор соединения
conn = mysql_init(NULL);
if(conn == NULL)
{
// Если дескриптор не получен – выводим сообщение об ошибке
fprintf(stderr, "Error: can'tcreate MySQL-descriptor\n");
//exit(1); //Если используется оконное приложение
}
// Подключаемся к серверу
if(!mysql_real_connect(conn, "10.10.0.144", "root", "1234", "test", NULL, NULL, 0))
{
// Если нет возможности установить соединение с сервером
// базы данных выводим сообщение об ошибке
fprintf(stderr, "Error: can'tconnecttodatabase %s\n", mysql_error(conn));
}
else
{
// Если соединение успешно установлено выводим фразу - "Success!"
fprintf(stdout, "Success!\n");
}
// Закрываем соединение с сервером базы данных
mysql_close(conn);
system("Pause");
return 0;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question