Why does console-vs2015 connect to the mysql database ??

Source: Internet
Author: User
Put libmysql. dll in the same place as the execution file exe. mysql's include and lib are all modified in the project properties, but nothing is output after the program is executed ???? Win32 console program: & quot; # include & quot; stdafx. h & quot; # include define socket # include & quot; mysql. h & quot; # pragmacomment (lib, & quot; libmysql. lib & quot;) and add mysql to the additional dependency. li mysql console

Put libmysql. dll in the same place as the execution file exe. mysql's include and lib are all modified in the project properties, but nothing is output after the program is executed ????
Win32 console program:

# Include "stdafx. h" # include
   
    
// Define socket # include
    
     
# Include "mysql. h "# pragma comment (lib," libmysql. lib ") // this sentence and add mysql to the additional dependency. lib has the same functions as using namespace std; int main () {MYSQL mysql; mysql_init (& mysql); if (mysql_real_connect (& mysql, "localhost", "root ","", "course", 8080, 0, 0) {cout <"OK" <endl; return 0;} else {int I = mysql_errno (& mysql ); const char * s = mysql_error (& mysql); cout <s <endl;} return 0 ;}
    
   

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.