views:

23

answers:

2

This is my first time fiddling with the windows world in over a decade, so this may be a simple fix. But I'm completely stuck.

Say you have a source directory,

mkdir helloworld && touch helloworld/helloworld.{h.cpp}

helloworld.cpp:

#include "helloworld.h"

using namespace std;

int main()
{
    cout << "Hello, World!" << endl;
    return 0;
}

helloworld.h:

#include <iostream>

Now you have a compile command that looks like:

cl.exe helloworld/helloworld.cpp

My understanding of standard behavior is that preprocessor lookups for quoted includes look

  • In the same directory of the source file
  • previously opened files
  • cli specified -I include paths
  • paths found in the INCLUDE environement

Now, this obviously falls into the first category, but I invariably get:

Z:\Projects\temp>cl helloworld\helloworld.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 16.00.30319.01 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

helloworld.cpp
helloworld\helloworld.cpp(1) : fatal error C1083: Cannot open include file: 'helloworld.h': No such file or directory 

So, as I was typing this I had a random thought...."what if it's because my project is on a shared filesystem?".

I copy the same project to C:\ and it compiles fine!

Does anyone have any idea what's going on here?

+1  A: 

Run procmon.exe (download it from sysinternals). See how CL opens the file, what sharemode, etc. It will tell you that the request has failed. You will be able to see the share options it asked for. It should obtain READ access with SHARE_READ (denies write), which is probably what your device didn't like.

Pavel Radzivilovsky
+1  A: 

Ok, I figured this out. It had to do with vmware's shared folders. My projects file was a vmware shared directory. To resolve this issue, I had to directly map the shared directory in windows and work from within that.

So for a vmware shared folder named 'Projects', you'd map \vmware-host\Shared Folders\Projects to Y: or whatever.

After that, it just started working.

jkyle