Kratos: [Compilation] Current master not compiling on Windows

Created on 20 May 2019  路  11Comments  路  Source: KratosMultiphysics/Kratos

See title. The following error occures:

   "C:\software_development\kratos\cmake_build\INSTALL.vcxproj" (Standardziel) (1) ->
   "C:\software_development\kratos\cmake_build\ALL_BUILD.vcxproj" (Standardziel) (3) ->
   "C:\software_development\kratos\cmake_build\kratos\KratosCore.vcxproj" (Standardziel) (14) ->
   (ClCompile Ziel) ->
     C:\software_development\kratos\kratos\utilities\os_utilities.cpp(19): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory [C:\software_development\kratos\cmake_build\kratos\KratosCore.vcxproj]

16 Warnung(en)
1 Fehler

It seems due to the changes made in #4911. Despite it is a Windows compilation, it tries to include this file. Some things were already discussed here: #4910. From a quick search, it seems for me a problem related to the #ifdef _WIN32 statement.

@loumalouomega Did you try the compilation on windows? Or can you reproduce this error?

Bug Compilation

All 11 comments

FYI @roigcarlo

How did it compile on AppVeyor?, I checked in my own Windows machine BTW

Can you replace the WINDOWS_COMPILATION macro for _WIN32?

Fixed on #4917, I restored the macro that worked previously

Just to say, you can use that macro but you first have to include "define.h", otherwise it dosn't see the correct value.

Just to say, you can use that macro but you first have to include "define.h", otherwise it dosn't see the correct value.

It was included on the header

but you included the header AFTER using the macro
~~~c
// System includes

include /* defines FILENAME_MAX */

ifdef KRATOS_COMPILED_IN_WINDOWS

include

define GetCurrentDir _getcwd

else

include

define GetCurrentDir getcwd

endif

// External includes

// Project includes

include "utilities/os_utilities.h"

~~~

thanks @roigcarlo this seems to be the source of error :+1:

Good to know that this is not a compiler error (which I would have expected) but a wrong behavior

but you included the header AFTER using the macro

// System includes
#include <stdio.h>  /* defines FILENAME_MAX */
#ifdef KRATOS_COMPILED_IN_WINDOWS
#include <direct.h>
#define GetCurrentDir _getcwd
#else
#include <unistd.h>
#define GetCurrentDir getcwd
#endif

// External includes

// Project includes
#include "utilities/os_utilities.h"

imagen

github totally needs this predefined :D

Was this page helpful?
0 / 5 - 0 ratings