简体   繁体   English

Visual Studio 2008找不到生成路径中的标头

[英]Visual Studio 2008 cannot find header that is in build path

Edit: I do not understand WHY this fixed the problem, but I added the include and lib directories to Tools>Options>Projects&Solutions>VC++Directories and it built perfectly. 编辑:我不明白为什么这可以解决此问题,但我将包含和lib目录添加到工具>选项>项目和解决方案> VC ++ Directories,它可以完美构建。

I'm trying to compile a c++ example project distributed by Autodesk in VS 2008. 我正在尝试编译VS 2008中由Autodesk分发的c ++示例项目。

The error: fatal error C1083: Cannot open include file: 'max.h': No such file or directory 错误:致命错误C1083:无法打开包含文件:'max.h':没有此类文件或目录

Previously when I have encountered this error it has been caused by forgetting to specify the location of a header in Project>Properties>Configuration>C++>General. 以前,当我遇到此错误时,是由于忘记在Project> Properties> Configuration> C ++> General中指定标头的位置引起的。 However, the path is definitely there this time and I can navigate to that directory and open max.h manually. 但是,这次路径肯定存在,我可以导航到该目录并手动打开max.h。

This project builds a DLL instead of an executable. 该项目将生成DLL而不是可执行文件。 Could that cause this? 会导致这个吗?

So as an experiment I wrote the complete path for max.h after the #include directive in the source. 因此,作为实验,我在源代码中的#include指令之后编写了max.h的完整路径。 Compile successful! 编译成功!

Linking failed:
fatal error LNK1181: cannot open input file 'edmodel.lib'

Yes edmodel.lib is located in a directory specified in Project>Properties>Configuration>Linker>General. 是edmodel.lib位于项目>属性>配置>链接器>常规中指定的目录中。

Any insight into what might be going on here would be appreciated. 任何对这里可能发生的事情的见解将不胜感激。

1. Make sure right configuration is selected when setting project properties 1.设置项目属性时,确保选择了正确的配置
Make sure you have set correct path in C/C++ -> General -> Additional Include Directories for all configurations (Debug, Release, some custom if you have any...). 确保在C / C ++->常规->其他包含目录中为所有配置(调试,发布,如果有的话,自定义一些)都设置了正确的路径。 When path to directory with headers is set properly, you can't have any problems with including them. 正确设置带有标头的目录的路径时,包含标头就不会有任何问题。

2. When using libraries, you have to specify path to these libraries but names of libraries you are going to use as well 2.使用库时,必须指定这些库的路径,但也要使用的库名称
You wrote, that you have set Linker -> General -> Additional Library Directories . 您写道,已经设置了Linker-> General-> Additional Library Directories But make sure that you have specified name of library in Linker -> Input -> Additional Dependencies as well. 但也要确保在链接器->输入->其他依赖项中也指定了库的名称。 You should append the name of library at the end: ;edmodel.lib 您应该在结尾处附加库的名称: ;edmodel.lib

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM