2012-11-12 49 views
0

我很喜歡用C++進行編程,請耐心等待。我目前正在使用NetBeans 7.2 for Mac Lion開發C++項目。對於這個項目,我的教授把代碼給了他的main.cpp(根據教授的說法,這是用C語言編寫的)。在NetBeans 7.2中找不到io.h

當我複製/粘貼他的代碼到我的項目中時,我在#include <io.h>行發現錯誤,指出「無法找到包含文件io.h」,隨後出現其他依賴性錯誤。我在網上搜索過,但似乎無法找到問題。我正在使用GCC/G ++編譯器,這使得所有的問題變得更加混亂。我的教授說「io.h」已經存在了,所以他不明白爲什麼它找不到。我嘗試從終端使用「定位io.h」命令。但是,對於我來說,它產生了太多的結果,以瞭解哪些是重要的。

我甚至試圖將代碼複製並粘貼到XCODE中,以發現「io.h」仍未找到。

任何有關這個問題的幫助將不勝感激。

生成文件...

# 
# There exist several targets which are by default empty and which can be 
# used for execution of your targets. These targets are usually executed 
# before and after some main targets. They are: 
# 
#  .build-pre:    called before 'build' target 
#  .build-post:    called after 'build' target 
#  .clean-pre:    called before 'clean' target 
#  .clean-post:    called after 'clean' target 
#  .clobber-pre:   called before 'clobber' target 
#  .clobber-post:   called after 'clobber' target 
#  .all-pre:    called before 'all' target 
#  .all-post:    called after 'all' target 
#  .help-pre:    called before 'help' target 
#  .help-post:    called after 'help' target 
# 
# Targets beginning with '.' are not intended to be called on their own. 
# 
# Main targets can be executed directly, and they are: 
# 
#  build     build a specific configuration 
#  clean     remove built files from a configuration 
#  clobber     remove all built files 
#  all      build all configurations 
#  help      print help mesage 
# 
# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and 
# .help-impl are implemented in nbproject/makefile-impl.mk. 
# 
# Available make variables: 
# 
#  CND_BASEDIR    base directory for relative paths 
#  CND_DISTDIR    default top distribution directory (build artifacts) 
#  CND_BUILDDIR    default top build directory (object files, ...) 
#  CONF      name of current configuration 
#  CND_PLATFORM_${CONF}  platform name (current configuration) 
#  CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration) 
#  CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration) 
#  CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration) 
#  CND_PACKAGE_DIR_${CONF} directory of package (current configuration) 
#  CND_PACKAGE_NAME_${CONF} name of package (current configuration) 
#  CND_PACKAGE_PATH_${CONF} path to package (current configuration) 
# 
# NOCDDL 


# Environment 
MKDIR=mkdir 
CP=cp 
CCADMIN=CCadmin 


# build 
build: .build-post 

.build-pre: 
# Add your pre 'build' code here... 

.build-post: .build-impl 
# Add your post 'build' code here... 


# clean 
clean: .clean-post 

.clean-pre: 
# Add your pre 'clean' code here... 

.clean-post: .clean-impl 
# Add your post 'clean' code here... 


# clobber 
clobber: .clobber-post 

.clobber-pre: 
# Add your pre 'clobber' code here... 

.clobber-post: .clobber-impl 
# Add your post 'clobber' code here... 


# all 
all: .all-post 

.all-pre: 
# Add your pre 'all' code here... 

.all-post: .all-impl 
# Add your post 'all' code here... 


# build tests 
build-tests: .build-tests-post 

.build-tests-pre: 
# Add your pre 'build-tests' code here... 

.build-tests-post: .build-tests-impl 
# Add your post 'build-tests' code here... 


# run tests 
test: .test-post 

.test-pre: 
# Add your pre 'test' code here... 

.test-post: .test-impl 
# Add your post 'test' code here... 


# help 
help: .help-post 

.help-pre: 
# Add your pre 'help' code here... 

.help-post: .help-impl 
# Add your post 'help' code here... 



# include project implementation makefile 
include nbproject/Makefile-impl.mk 

# include project make variables 
include nbproject/Makefile-variables.mk 
+1

它是'#include '還是'#include「io.h」'? –

+0

你能分享你的makefile嗎?很可能您沒有使用正確的包含路徑。 (在我的linux系統中'io.h'在'/ usr/include/sys /'中) –

+0

我試過和「io.h」 – user1817120

回答

1

置身於另一個問題時說, 「事實上,io.h頭從來沒有的ISO C也不C++標準的一部分。」 (failing to compile a project, missing io.h file) 在這個問題中,最高的答案給一個小圖書館io.h。我相信它會解決你的問題。 :-)

+0

我會查看該鏈接,謝謝。是的,我試過sys/io.h – user1817120