0
我正在使用QG Creator和MinGW。我不能使用MinGW包含winsock2.h
我包含了「windows.h」並編譯它,但失敗了。錯誤如下:
In file included from c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/windows.h:98:0,
from util/IdleDetector.h:8,
from service\PresenceService.cpp:8:
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/winsock2.h:771:22: error: expected unqualified-id before string constant
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/winsock2.h:1034:95: error: expected identifier before string constant
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/winsock2.h:1034:95: error: expected ',' or '...' before string constant
我以爲MinGW路徑丟失,但事實並非如此。我怎樣才能解決這個問題?
你winsock2.h的行771和1034是什麼?你有沒有在windows.h之前明確地嘗試過包括winsock2.h? – thiton
這些行中沒有字符串常量。請顯示您的完整編譯命令,並檢查您是否定義了#。如果'GROUP'被定義爲字符串文字,這兩行將會失效。 – Mat
我用編輯GROUP解決了它。非常感謝你 –