2014-02-05 74 views
0

首先我想說我完全是C或C++的noob。我試圖理解編譯工作的方式,語言的工作原理等。這次我在這裏發佈前一直在尋找一個解決方案好幾個小時。我希望你能幫助我,即使它看起來是一個非常容易找到的解決方案。編譯時出錯C2062

這是它。

我試圖執行nmake一個makefile.Win32文件,我得到了這些錯誤:

e:\progs\c\vanitygen-master\winglue.h(47) : error C2062: type 'char' unexpected 
e:\progs\c\vanitygen-master\winglue.h(47) : error C2143: syntax error : missing ';' before '{' 
e:\progs\c\vanitygen-master\winglue.h(47) : error C2447: '{' : missing function header (old-style formal list?) 
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cl.EXE"' : code retour '0x2' 
Stop. 

這裏是winglue.h文件( - >點線47)

#include <windows.h> 
#include <tchar.h> 
#include <time.h> 

#define INLINE 
#define snprintf _snprintf 

struct timezone; 

extern int gettimeofday(struct timeval *tv, struct timezone *tz); 
extern void timeradd(struct timeval *a, struct timeval *b, 
     struct timeval *result); 
extern void timersub(struct timeval *a, struct timeval *b, 
     struct timeval *result); 

extern TCHAR *optarg; 
extern int optind; 

extern int getopt(int argc, TCHAR *argv[], TCHAR *optstring); 

extern int count_processors(void); 

#define PRSIZET "I" 

static inline char * 
/* --> */ strtok_r(char *strToken, const char *strDelimit, char **context) { 
return strtok_s(strToken, strDelimit, context); 
} 

#endif /* !defined (__VG_WINGLUE_H__) */ 

我希望你們能幫助我! 我在Win 7 64位計算機上使用Visual Studio C++ 2010 Express。

編輯:如果有助於瞭解它,我正在運行一個全新的軟件安裝。

+0

看起來像一個愚蠢的重新定義'字符'通過宏或這樣的。您是否嘗試過使用'TCHAR'類型? –

+0

是的。我嘗試了tchar,int和其他類型。我甚至沒有任何類型的嘗試。沒有幫助。 感謝您的關注! – Cyc

+0

您是否對源代碼做過任何修改? – molbdnilo

回答

0

簡單的解決方法是使其成爲一個定義,您使用相同的順序調用具有相同參數的不同函數,並返回結果。

但是至於你的問題的原因,它是一個愚蠢的定義在<windows.h>,它有很多定義它不應該。我猜測它的內聯。改爲嘗試。

+0

感謝提示,我會在這方面做一些研究。然而,將'inline'改爲'__inline__'沒有幫助。 – Cyc

+0

如果您只是想快速修復,請將整個函數defenition更改爲#define strtok_r strtok_s – sp2danny