연결 오류 문제 :MySQL의 커넥터/C++ 라이브러리 문제
좋아, 내가 MySQL의 포지 위키 간단한 데이터베이스 연결을 얻는 방법에 대한 자습서를 제공하는 다른 웹 사이트에있는 샘플 코드를 따라하려고했는데 , 그러나 어떤 이유에서, 내 프로젝트는 항상 링크 오류에서 실패하고 나는 그것을 (왜 아직도 배우고있어) 고칠 수있는 이유 또는 방법을 알아낼 수 없습니다. 제발 도와주세요! 헤더 파일에 필요한 경로 디렉토리를 프로젝트 속성에 포함하고 MySQL Connector/C++에서 사용되는 lib 파일에 경로 디렉토리를 제공했습니다. 다른 누군가가 나에게 도움이되는 힌트/코멘트를 줄 수 있다면 아래 코드를 사용합니다. lib 파일에 연결하는 것과 관련이 있다고 생각합니다 (링크 오류 때문에). 그러나 해결할 해결책을 모르겠습니다. 다른 사람이 이런 문제가 있었나요?
http://forge.mysql.com/wiki/Connector_C++ http://dev.mysql.com/tech-resources/articles/mysql-connector-cpp.html#createdb
CODE :
int main() {
// do something
sql::mysql::MySQL_Driver *driver;
sql::Connection *con;
sql::Statement *stmt;
sql::ResultSet *res;
sql::PreparedStatement *pstmt;
cout << "Starting Driver Instance" << endl;
driver = sql::mysql::MySQL_Driver::get_mysql_driver_instance();
return 0;
}
오류 출력 :
UPDATE1>------ Build started: Project: test, Configuration: Debug Win32 ------
1>Compiling...
1>main.cpp
1>c:\users\josh bradley\documents\visual studio 2008\projects\test\test\main.cpp(28) : error C2039: 'get_mysql_driver_instance' : is not a member of 'sql::mysql::MySQL_Driver'
1> c:\program files\mysql\mysql connector c++ 1.0.5\include\mysql_driver.h(25) : see declaration of 'sql::mysql::MySQL_Driver'
1>c:\users\josh bradley\documents\visual studio 2008\projects\test\test\main.cpp(28) : error C3861: 'get_mysql_driver_instance': identifier not found
1>Build log was saved at "file://c:\Users\Josh Bradley\Documents\Visual Studio 2008\Projects\test\test\Debug\BuildLog.htm"
1>test - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
: 난 그냥 모두가 알려 드리고자합니다
내가 마침내 발견 방법 내 문제를 해결해. 비슷한 문제가있는 사람은 http://blog.ulf-wendel.de/?p=215#hello으로 가서 mysqlcppconn.lib에 동적으로 연결하는 방법을 읽어보십시오. 내 문제는 실제 환경을 설정하여 라이브러리에 올바르게 연결하고이 자습서가 대단히 도움이되었습니다!
글쎄, 나는 이미 그것을 시도하고 나는 다음과 같은 연결 오류가 여전히 1> main.obj : 오류 LNK2019 : 확인되지 않은 외부 기호 "__declspec (같이 DllImport) 클래스 SQL :: mysql을 :: MySQL_Driver * __cdecl의 SQL : : mysql :: get_mysql_driver_instance (void) "함수 _main에서 참조 된 __imp_? get_mysql_driver_instance @ mysql @ sql @@ YAPAVMySQL_Driver @ 12 @ XZ) –
연결 오류는 사용자가 분명히 적절한 라이브러리에 연결하지 않았 음을 나타냅니다. –