Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
620 views
in Technique[技术] by (71.8m points)

c++ - C1083: Cannot open include file: math.h: No such file or directory

I have a bunch of these errors and am at a dead end.

Found plenty of answers on google but unfortunately none of them work

I am using Visual Studio 2012.

All the files it says is cant find are on my computer in this folder

C:Program FilesMicrosoft Visual Studio 11.0VCinclude

Even when I right click on the include statement and click on 'Open Document ' it takes me to the document, so it is clearly there and can be seen

I tried adding the directory to the 'Additional Directories' field in options too but did not solve it.

If I use the include statement with the full path like so :

#include <C:Program FilesMicrosoft Visual Studio 11.0VCincludemath.h>

Then is works but if the math.h file has any include statements I need to add the path to them as well and so on.

Any Idea what is happening and what else I can try?

EDIT: Going to try and create a new project from scratch and see if that helps. It is possible I touched a settings I shouldn't have

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Right-click your project, go to Properties, then go to VC++ Directories and open the editor for Include Directories. There should be a tick box labelled "Inherit from parent or project defaults". You will see that Visual Studio includes some predefined directories.

If the box is already ticked and Visual Studio isn't finding the directories then try adding these directories yourself:

$(VCInstallDir)include
$(VCInstallDir)atlmfcinclude
$(WindowsSDK_IncludePath)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...