Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vs2010 - Can not open include file 'sys/param.h

When i compile my C++ solution in vs2010 x64 mode, i get the below compilation issue. Can not open include file 'sys/param.h' :No such file or directory.

But the same compiles fine in Win32 mode.

I am not sure how this header file is missing.Can any one help me on this? I am using some of the client headers and this is the below code section that is present in the client file.
#ifndef WIN32
#include <sysipc.h>
#include <sys/param.h>
#endif

like image 501
user1706047 Avatar asked Oct 04 '22 04:10

user1706047


2 Answers

The include #include <sysipc.h> should be #include <sys/ipc.h>, however, this is a POSIX header file that is meant for Linux build projects so it won't work for any Visual Studio projects. Since you're compiling for x64, WIN32 flags might not be set by default.

Try changing the macro to:

#ifndef _MSC_VER
#include <sys/ipc.h>
#include <sys/param.h>
#endif // !_MSC_VER

Hope that helps.

like image 177
Richard Vu Avatar answered Oct 07 '22 03:10

Richard Vu


This is highly likely a consequence of some #if going wrong - e.g. it's checking for _M_IX86, and it not being set on a 64-bit system, it picks up something non-windows and tries to compile that.

sys/param.h is a unix/linux header-file, and you shouldn't expect to find that in your Windows system. [edit: unless you hooked in a version of the GNU compiler or did some other modification to the compilation tools core of your MSVC build environment]

Unfortunately, without seeing the source code, all we can possibly do is explain the possible reasons...

like image 24
Mats Petersson Avatar answered Oct 07 '22 03:10

Mats Petersson