# Define WIN32_LEAN_AND_MEAN

Source: Internet
Author: User

Today, I checked mysql database + vc to connect to the database. As a result, I used the mfc application Wizard to create a project and then added # include "mysql. h "(environment already set), a lot of errors occur during compilation, as shown below:

Compiling...
StdAfx. cpp
C: mysqlincludemysql_com.h (116): error C2146: syntax error: missing '; 'before identifier' fd'
C: mysqlincludemysql_com.h (116): error C2501: 'socket ': missing storage-class or type specifiers
C: mysqlincludemysql_com.h (116): error C2501: 'fd ': missing storage-class or type specifiers
C: mysqlincludemysql_com.h (180): error C2065: 'socket ': undeclared identifier
C: mysqlincludemysql_com.h (180): error C2146: syntax error: missing ') 'Before identifier's'
C: mysqlincludemysql_com.h (181): error C2059: syntax error :')'
Error executing cl.exe.

 

After searching for a long time on the Internet and failing to find the answer, I checked examples in the mysql root directory. Is there a project written in c ++? I debugged it, I think mysql can be compiled. h. There will be no errors in this file. It should be the include conflict during compilation, so I will put stdafx. h. delete several lines of the file. When I block the # define WIN32_LEAN_AND_MEAN statements, I can compile the file. I also tried mysql_init (MYSQL *) 0 ); this function is correct. so the problem lies in define WIN32_LEAN_AND_MEAN.

# Define WIN32_LEAN_AND_MEAN indicates that the compiler should not contain MFC-related operations. (Just a good exercise-if you are not using MFC) And we include dxutil. h and ddutil. h, which are two useful header files. They allow you to work in a way that is easier than the usual DirectX programming.

 

 

Why # define WIN32_LEAN_AND_MEAN.

The answer is very simple, because I want to include content that is as concise as possible. It is much faster to compile this sentence.

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.