Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Visual Studio 2017 see my .h file using angle brackets?

I have a Visual Studio 2017 solution and C++ project with one source file called Source.cpp. Inside Source.cpp I have #include <FL/Fl.H> which appears red underlined because Visual Studio cannot find it.

On my file system, I have verified that the file c:\fltk\include\FL\Fl.H exists, and I right clicked my project and added the directory c:\fltk\include into the project Include Directories.

Hopefully this picture can explain my frustration VS2017 not finding the file

How can I get Visual Studio 2017 to include the file?

like image 368
Mark Avatar asked Nov 26 '17 03:11

Mark


1 Answers

The answer has to do with the Solution Platform and the Solution Configuration

As you can see in the screenshot, the property pages are set to edit Configuration: Release and Platform: x64 which happened to be different from my "Active Solution Platform" and "Active solution configuration" which was set to Debug and x86 respectively. See the screenshot below.

active solution and platform

When I switched to Configuration: All Configurations and Platform: All Platforms and then added the include folder, everything worked! See the screenshot below. enter image description here

Also note I changed from using the VC++ Directories option group to the C/C++ option group. I haven't quite understood what the difference is although there are some explanations here What is the difference between "Include Directories" and "Additional Include Directories"

I'm still unclear why this question got downvoted, but I think this answer will probably be useful to other Visual Studio newbies who made the same mistake I did.

like image 70
Mark Avatar answered Oct 24 '22 03:10

Mark