Visual Studio에서 프로그래밍의 DB (특히 MariaDB)를 엉망으로 만든 나의 첫 번째 침략과 많은 행운이 없다. 내가 잘못 설정 한 것처럼 보이지만 설정을 꼼짝 않고 오류가 표시되지 않습니다. 그곳은 더 경험 많은 코더들에게 분명히 드러날 것 같지만 나무 때문에 숲을 볼 수는 없습니다.Visual Studio 커뮤니티 2017 링커 문제 - MariaDB
각각의 라이브러리로 x86 및 64 비트 컴파일을 시도했습니다. 난 단지 아래의 86 설정을 포함했지만 그들은 동일 APART 대신 "프로그램 파일 86"
내 코드는 순간에 매우 간단합니다의에서 "프로그램 파일"을 가리키는에서 :
#include "stdafx.h"
#include <mysql.h>
int main()
{
MYSQL* temp;
temp = mysql_init(NULL);
return 0;
}
하지만 컴파일하려고하면 다음과 같은 결과가 나옵니다.
1>------ Build started: Project: test, Configuration: Debug Win32 ------
1>test.cpp
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>mariadbclient.lib(mariadb_lib.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _mysql_once_init
1>mariadbclient.lib(mariadb_lib.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _mysql_once_init
1>mariadbclient.lib(mariadb_lib.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _mysql_optionsv
1>mariadbclient.lib(mariadb_lib.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _mysql_optionsv
1>mariadbclient.lib(ma_init.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _my_win_init
1>mariadbclient.lib(ma_init.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _ma_end
1>mariadbclient.lib(ma_pvio.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _ma_pvio_read_async
1>mariadbclient.lib(mariadb_async.obj) : error LNK2001: unresolved external symbol [email protected]
1>mariadbclient.lib(pvio_socket.obj) : error LNK2001: unresolved external symbol [email protected]
1>mariadbclient.lib(ma_default.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _get_default_configuration_dirs
1>mariadbclient.lib(mariadb_async.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _my_connect_async
1>mariadbclient.lib(pvio_socket.obj) : error LNK2001: unresolved external symbol [email protected]
1>mariadbclient.lib(mariadb_async.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _my_connect_async
1>mariadbclient.lib(pvio_socket.obj) : error LNK2001: unresolved external symbol [email protected]
1>mariadbclient.lib(pvio_socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _pvio_socket_wait_io_or_timeout
1>mariadbclient.lib(pvio_socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _pvio_socket_connect
1>mariadbclient.lib(pvio_socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _pvio_socket_connect
1>mariadbclient.lib(pvio_socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _pvio_socket_blocking
1>mariadbclient.lib(pvio_socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _pvio_socket_async_read
1>mariadbclient.lib(pvio_socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _pvio_socket_wait_io_or_timeout
1>mariadbclient.lib(pvio_socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _pvio_socket_async_write
1>mariadbclient.lib(pvio_socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _pvio_socket_fast_send
1>mariadbclient.lib(pvio_socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _pvio_socket_close
1>mariadbclient.lib(pvio_socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _pvio_socket_connect
1>mariadbclient.lib(pvio_socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _pvio_socket_wait_io_or_timeout
1>mariadbclient.lib(pvio_socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _pvio_socket_connect
1>mariadbclient.lib(pvio_socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _pvio_socket_connect
1>mariadbclient.lib(ma_schannel.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _ma_schannel_load_private_key
1>mariadbclient.lib(ma_schannel.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _ma_schannel_load_private_key
1>mariadbclient.lib(ma_schannel.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _ma_schannel_load_private_key
1>mariadbclient.lib(ma_schannel.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _ma_schannel_load_private_key
1>d:\nikuya\documents\visual studio 2017\Projects\test\Debug\test.exe : fatal error LNK1120: 27 unresolved externals
1>Done building project "test.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
내 설정은 다음과 같습니다 -
VC++ Directories -> Include Directories -> C:\Program Files %28x86%29\MariaDB\MariaDB Connector C\include\mysql
VC++ Directories -> Include Directories -> C:\Program Files %28x86%29\MariaDB\MariaDB Connector C\include\mysql\include
VC++ Directories -> Library Directories -> C:\Program Files %28x86%29\MariaDB\MariaDB Connector C\lib
VC++ Directories -> Library Directories -> C:\Program Files %28x86%29\MariaDB\MariaDB Connector C\lib\plugin
C++ Directories -> Addition Include Directories -> C:\Program Files %28x86%29\MariaDB\MariaDB Connector C\include\mysql
C++ Directories -> Addition Include Directories -> C:\Program Files %28x86%29\MariaDB\MariaDB Connector C\include
Linker -> General -> Addition Library Directories -> C:\Program Files %28x86%29\MariaDB\MariaDB Connector C\lib\plugin
Linker -> General -> Addition Library Directories -> C:\Program Files %28x86%29\MariaDB\MariaDB Connector C\lib
Linker -> Additional Dependancies -> mariadbclient.lib
Linker -> Additional Dependancies -> libmariadb.lib
어떤 도움을 주시면 감사하겠습니다 그리고 더 이상의 정보가 필요한 경우 문의하시기 바랍니다.
참고 : 필자는 절망에서 windows.h를 포함하여 시도했지만 주사위는 사용하지 않았습니다.
말이 내가 올바른 런타임 라이브러리를 발견하고 경고가 지금왔다. 그러나 연결 오류가 남아 있습니다. – Lucas
일부 표준 Windows API 라이브러리가 누락되었습니다. 예를 들어 MSDN에서'closesocket'을 찾으면 링크 할 추가 라이브러리를 알려줍니다. –
두 분 모두에 감사드립니다. 분류 해 놨어. msdn에서 함수를 찾고 개별 라이브러리에 링크해야합니다. – Lucas