error C2146: syntax error : missing ';' before identifier 'fd'
生活随笔
收集整理的這篇文章主要介紹了
error C2146: syntax error : missing ';' before identifier 'fd'
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
這幾天用mysql5.1 c++ api +VC6.0編程時編譯器報錯:error C2146: syntax error : missing ';' before identifier 'fd'
跟進mysql_com.h文件中的? my_socket fd;???? /* For Perl DBI/dbd */行,發現編譯器對my_socket不能識別,而在mysql.h中對my_socket有定義:#define my_socket SOCKET,那么接下來就是SOCKET定義了。SOCKET定義是在winsock2.h中,但由于加了預定義#ifdef __LCC__所以頭文件winsock2.h根本沒有包含進來,沒辦法只有自己包含了。
解決辦法:在#include<mysql.h>前加上#include<winsock2.h>即可!
總結
以上是生活随笔為你收集整理的error C2146: syntax error : missing ';' before identifier 'fd'的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 单文档自定义工具栏
- 下一篇: lcx转发3389数据