Compilation fails in VS2010 for C++ programs building fine in Linux

后端 未结 3 618
独厮守ぢ
独厮守ぢ 2021-01-29 04:32

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.

Err         


        
相关标签:
3条回答
  • 2021-01-29 05:07

    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?

    0 讨论(0)
  • 2021-01-29 05:15

    You will get better results easier ifyou use some port of gcc compiler for Windows. Try mingw32 or cygwin. Visual Studio is good compiler, but it is not the same as gcc and doesn't have identical libraries, so you will need to rewrite some parts of your source code.

    The errors you get are about missing functions.

    0 讨论(0)
  • 2021-01-29 05:19

    You can't port linux programs on windows without changing the sources a bit because they use different headers

    0 讨论(0)
提交回复
热议问题