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
How can I get Visual Studio 2017 to include the file?
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.
When I switched to Configuration: All Configurations and Platform: All Platforms and then added the include folder, everything worked! See the screenshot below.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With