似乎有幾個不同類別的錯誤:
main.cpp:8:19: error: conio.h: No such file or directory
main.cpp:61: error: ‘_kbhit’ was not declared in this scope
conio.h
是窗口的控制檯IO頭。 _kbhit是其中的一個功能。
main.cpp:17: warning: deprecated conversion from string constant to ‘char*’
ANSI C++中的字符串常量類型爲const char *
。如果你使用C++ std :: string而不是使用new的C字符串,那麼在代碼中也會出現很多奇怪的字符串函數。
vbinary.cpp:5:16: error: io.h: No such file or directory
vdirectory.cpp:91: error: ‘_findfirst’ was not declared in this scope
vdirectory.cpp:99: error: ‘_findnext’ was not declared in this scope
vdirectory.cpp:101: error: ‘_findclose’ was not declared in this scope
vfile.cpp:19: error: ‘_MAX_DRIVE’ was not declared in this scope
vfile.cpp:20: error: ‘_MAX_DIR’ was not declared in this scope
vfile.cpp:21: error: ‘_MAX_FNAME’ was not declared in this scope
vfile.cpp:22: error: ‘_MAX_EXT’ was not declared in this scope
io.h
是另一個微軟頭,與導航目錄的功能,並與他們使用的宏。改爲使用dirent.h
中的功能。諸如VDirectory::CreatePath
之類的函數假定存在單獨的驅動器號; unix文件系統不這樣做,因此最好爲這些實現設置完全分離的類,而不是嘗試使用#ifdef
s將兩個單獨的實體放入每個函數中,並使用一個#ifdef在main中選擇合適的一個。
常量如_MAX_FNAME
在io.h和微軟的stdlib.h中。它們不在標準stdlib.h
中,它們的輸入大小也不受限制。 POSIX版本使用NAME_MAX
。
奇怪的是,它不包含windows.h並且在戰略位置擁有#ifdef WIN32,但仍需要移植 - 您是否已經開始移植代碼? – 2009-09-23 19:31:46
我應該說這不是我的代碼。如果可能的話,我只是試圖構建一個unix版本的工具。 :) – 2009-09-23 20:32:52