C/C++串連MySql資料庫

來源:互聯網
上載者:User

標籤:software   資料庫   檔案夾   c++   

本文檔是關於如何使用MySql的API串連MySql資料庫,開發環境為VS2013.

開發環境設定:

先確定以下兩個位置

mysql.h所在位置:C:\software\wamp\bin\mysql\mysql5.5.20\include

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/73/FC/wKioL1YLpi3BfVkFAAOFsizaBzw575.jpg" title="1.png" alt="wKioL1YLpi3BfVkFAAOFsizaBzw575.jpg" />

libmysql.lib所在位置:F:\mysql\mysqllib

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/73/FF/wKiom1YLpi_CcmdJAAEA4_tYQ34864.jpg" title="2.png" alt="wKiom1YLpi_CcmdJAAEA4_tYQ34864.jpg" />

需要把VS2013的工程中的標頭檔路徑和串連庫路徑指向上面的兩個地方:

將該項目屬性頁面的C/C++->常規->附加元件封裝含目錄指向:C:\software\wamp\bin\mysql\mysql5.5.20\include

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/73/FF/wKiom1YLpkbB4QriAAJie6PWW8E418.jpg" title="3.png" alt="wKiom1YLpkbB4QriAAJie6PWW8E418.jpg" />

將項目屬性頁面的連結器->常規->附加庫目錄指向: F:\mysql\mysqllib 

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/73/FC/wKioL1YLpnWw1xlGAAKHjUuxdJY049.jpg" title="4.png" alt="wKioL1YLpnWw1xlGAAKHjUuxdJY049.jpg" />

將連結器->輸入->附加依賴項中添加libmysql.lib。

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/73/FF/wKiom1YLpnjiBMRsAAJEXRBU7tE492.jpg" title="5.png" alt="wKiom1YLpnjiBMRsAAJEXRBU7tE492.jpg" />

需要把libmysql.dll放到項目Debug檔案夾中

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/73/FC/wKioL1YLpp-gKvmIAADI4Mzbcr4603.jpg" title="6.png" alt="wKioL1YLpp-gKvmIAADI4Mzbcr4603.jpg" />

否則會出現以下錯誤:

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/73/FC/wKioL1YLpq3SkDURAABTNARgtPI783.jpg" title="7.png" alt="wKioL1YLpq3SkDURAABTNARgtPI783.jpg" />


本文出自 “MySQL” 部落格,請務必保留此出處http://wenjing.blog.51cto.com/5908329/1699619

C/C++串連MySql資料庫

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.