2011-03-04 103 views
1

我的代碼中有這些行。我還將該文件包含在我的項目中的標題列表中。但是當編譯時,我得到了下面的錯誤。我的錯誤是什麼?包含文件錯誤?

#ifndef WIN32 
# include <netinet/in.h> 
# include <arpa/inet.h> 
# include <unistd.h> 
# include <netdb.h> 
# include <sys/socket.h> 
# include <sys/un.h> 
# include <pwd.h> 
# include <grp.h> 
#else 
# include "getopt.h" 
# include <stdarg.h> 
# pragma comment (lib, "wpcap.lib") 
#endif /* ^WIN32 */ 

錯誤1個致命錯誤C1083:無法打開包括文件: 'getopt.h':沒有這樣的文件或目錄C:\ filetry.c

回答

0

getopt的是不是一個視覺C頭。這可能幫助:http://www.codeguru.com/forum/archive/index.php/t-393293.html

+0

但該文件已經是我的解決方案的目錄內。爲什麼ms visual studio可以找到它? – karikari 2011-03-04 08:47:02

+0

然後,你需要無論是頭部添加到相同的同一目錄中,包括它的源文件,或添加包含頭到項目的包含路徑解決方案目錄。 – Ralf 2011-03-06 07:10:44