fdopen mkdir chdir etc. with Visual Studio 2017 - Clang with Microsoft CodeGen (v141_clang_c2)

  • Thread starter Thread starter slymz
  • Start date Start date
S

slymz

Guest
Here is a code snippet that is causing trouble:

#include <stdio.h>

void foo() {
FILE* f = fdopen(1,"r");
}

In MSVC toolsets, this works (one gets warning C4996, which can be silenced with /D_CRT_NONSTDC_NO_WARNINGS)

In Clang with Microsoft Codegen, we get

foo.cpp(9,15): error : use of undeclared identifier 'fdopen'
FILE* f = fdopen(1,"r");





Please note that, in our production environment the trouble is really coming from third party libraries that I am not at liberty to modify. Unfortunately, these third party libraries which are otherwise useful (e.g. Google Test), have made an apparently poor assumption that on Windows fdopen etc would be available.

The one super hacky workaround I find is to undefine __STDC__ (which does not always work). Is there a better workaround?

thanks

Continue reading...
 
Back
Top