在VS2010中编译失败的C ++程序在Linux中可以正常工作 [英] Compilation fails in VS2010 for C++ programs building fine in Linux
问题描述
错误1错误C2061:语法错误:标识符'acosf'c :\ program files \microsoft visual studio 10.0 \vc\include\cmath 19 1 MyPROJ
<
错误1错误C3861:'lseek':标识符未找到g :\project\file.cc 274 1 MyPROJ
错误2错误C3861:'写入':标识符未找到g:\project\file.cc 275 1 MyPROJ
如何消除这些错误。
lseek和write是不是C标准的一部分的unix(posix?)调用。
它们在窗口中可用,但使用名称_lseek和_write
虽然不确定acosf
编辑:acosf应该可用,你包括math.h
编辑更多:仔细查看原始帖子错误是在cmath这是罚款,虽然然后你可能必须写std :: acosf - 但是错误在include文件中。当我尝试它时,它的工作正常,所以包含之前的某些内容可能会发生冲突。在您的来源中包含cmath之前是什么?
My C++ project builds and runs fine on Linux. Now I am trying to compile it in VS2010. I get many errors seemingly from cmath library like the following one.
Error 1 error C2061: syntax error : identifier 'acosf' c:\program files\microsoft visual studio 10.0\vc\include\cmath 19 1 MyPROJ
Also I get many file operations related compilation errors like:
Error 1 error C3861: 'lseek': identifier not found g:\project\file.cc 274 1 MyPROJ
Error 2 error C3861: 'write': identifier not found g:\project\file.cc 275 1 MyPROJ
How to eliminate these errors.
lseek and write are unix (posix?) calls that are not part of the C standard. They are available on windows but using the names _lseek and _write
not sure about acosf though
EDIT: acosf should be available, are you include math.h
Edit more: Looking more closely at the original post the error is in cmath which is fine although then you probably have to write std::acosf - but the error is in the include file. It works fine when I try it so something before the include is likely conflicting. What is before the include of cmath in your source?
这篇关于在VS2010中编译失败的C ++程序在Linux中可以正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!