Visual Cannot Open Include Files

I am moving an OSX JUCE project to Windows. It seems the projucer does not add the include paths of my files to the Visual Studio project.
So I get the error "Cannot Include File “…” ".
Looking at my project properties I can’t see any path added, neither in VC++ Directories or in C/C++.
Still I can see the files in the project explorer, and adding the paths of the files manually fix the issue. But it will be overwritten by the Projucer.

It is pretty obvious something is wrong on my end. What can it be? What should I check to debug this?

P.S: I am using Parallels Desktop.

1 Like

Hi BaptisteB,

Have you added any include paths to the Debug and Release configurations underneath the XCode (MacOSX) target in the Projucer? If so you’ll need to do the same for the configurations under whichever version of Visual Studio you are using.

Hi T0m, thanks for your reply,

No, I haven’t added any path in the Debug or Release for XCode. The files it cannot find are the one added in the Projucer just by dragging them in the “Files” component.

But I know XCode is different as it does not require you to add the paths if the files are in the project explorer.

Isn’t the Projucer supposed to add the paths automatically in the Visual Studio project? Should I write them manually in the VS target?

Thanks again

No, you need to add the header search paths yourself for each configuration in the ProJucer.
This is the same in VisualStudio itself: you can drag in files all that you want, but the required header search paths need to be added as well.

2 Likes

I see! Thank you both of you.

If these files are all your own, within your own project folder, then it’s best practice to make sure they’re included via the correct relative paths, rather than expecting the IDE to figure out where a file lives based on its filename alone. Xcode is certainly unusual in allowing you to be lazy like that. And I’ve always felt that including by filename-only and adding a bunch of paths to your project so that other IDEs can find them is a messy overhead given that using the relative paths will always make sure the correct file is used without any changes to your project (and will also eliminate problems caused by duplicate filenames)

2 Likes

Wish list: Projucer would detect this and give a warning for these cases -
Warning: Project uses includes in Xcode-specific - non-cross-platform way.

Would it be possible to have an option in the Projucer to disable these recursive includes? 9 out of 10 times my CI builds fail on windows is when AppCode decides to auto-include a file just by it’s name. If recursive includes would be disabled, I’d be able to catch that earlier.

(That is, if that’s the option that is causing that behaviour in XCode / AppCode / Clang).

1 Like

No idea whether it’s possible to disable it, TBH…

I think that’s the “Use Header Maps” option in Xcode under the “Search Paths” category.
see http://www.crickettechnology.com/blog/?p=671

Actually looks like HEADERMAP_INCLUDES_FLAT_ENTRIES_FOR_TARGET_BEING_BUILT is the better option to turn off, the other one hurts <Framework/Header.h> includes too…

2 Likes

EDIT: the below problem was actually my bad due to some Xcode options I set… nevermind

This problem now bited me.
I tried to add the juce_audio_formats module to my project, and apparently it includes libFLAC’s assert.h file, which replaces the standard <assert.h> for another library I’m using which includes it.
I’ll look into setting the relevant Xcode project to solve this issue.

Hey, did you manage to fix this? I’m trying to use the stl_image project but it’s picking up the flac assert.h instead of the C assert.h. I’ve disabled HEADER_MAPs.

Ignore, I was doing a silly recursive include…