我如何表明库和& 2015年MS visual studio社区中的头文件位置 [英] How do I indicate library & header file locations in MS visual studio community 2015
问题描述
我正在使用cURL在MS Visual Studio社区2015中编写一个非常简单的程序。 cURL在这里安装头文件:
C:\Program Files(x86)\CURL \include\curl
一点点令人尴尬,但我无法弄清楚为什么MS Visual Studio找不到包含在该目录中的curl.h文件。
我已经包含了这条路径:
C / C ++ |一般|附加包含文件
我的stadfx.h包含以下行:
#include < curl.h >
但编译时出现此错误:
致命错误C1083:无法打开包含文件:'curl.h':没有这样的文件或目录
当我更改行时,项目编译正常stadfx.h to:
#include C:\Program Files(x86)\CURL \include\curl\curl.h
我可以继续使用它,但我对库路径有类似的问题。我想链接libcurl_imp.lib,它在这里:
C:\Program Files(x86)\CURL \lib
我把这条路包含在:
Linker |一般|其他图书馆目录
我将libcurl_imp.lib添加到:
Linker |输入|额外的依赖性
但我得到的所有LIBCURL函数调用都没有解析外部。
建议非常欢迎!
谢谢
我的尝试:
我也尝试将路径包含在:
VC ++目录|包含目录
对于单个应用程序(使用这些依赖项的唯一应用程序),将属性添加到项目中:
C ++ - 常规 - 附加包含目录:C:\Program Files(x86)\CURL \ include
链接器 - 常规 - 其他库目录:C:\Program Files(x86)\CURL \lib
在源文件中包含头文件像往常一样。
要链接其他图书馆,您有两种选择:
- 将名称添加到项目设置链接器 - 输入 - 附加依赖项
- 使用编译指示评论(C / C ++) [ ^ ]声明:
#pragma comment(lib,lib-name)
你走在正确的轨道上,但看起来你使用了错误的库。
看看 stackoverflow 因为他们使用了antoher和其他库以及 curl的原始示例代码。
I'm writing a very simple program in MS Visual Studio Community 2015 that uses cURL. cURL installs header files here:
C:\Program Files (x86)\CURL\include\curl
A little embarrassing, but I cannot figure out why MS Visual Studio cannot find include file curl.h which is in that directory.
I've included that path in:
C/C++ | General | Additional Include files
My stadfx.h has the line:
#include <curl.h>
but I get this error when I compile:
fatal error C1083: Cannot open include file: 'curl.h': No such file or directory
The project compiles OK when I change the line in stadfx.h to:
#include "C:\Program Files (x86)\CURL\include\curl\curl.h"
I could just go with that but I have a similar problem with the library paths. I want to link with libcurl_imp.lib, which is here:
C:\Program Files (x86)\CURL\lib
I've included that path in:
Linker | General | Additional Library Directories
and I added libcurl_imp.lib to:
Linker | Input | Additional Dependencies
but I get unresolved externals for all of the LIBCURL function calls I make.
Suggestions are most welcome!
Thanks
What I have tried:
I've also tried including the path in:
VC++ Directories | Include Directories
For a single application (the only application using these dependencies) add the properties to your project:
C++ - General - Additional Include Directories: "C:\Program Files (x86)\CURL\include"
Linker - General - Additional Library Directories: "C:\Program Files (x86)\CURL\lib"
Include the header files in your source files as usual.
To link against additional libraries you have two options:
- Add the names to the project settings at Linker - Input - Additional Dependencies
- Import the library in one of your source files using a pragma comment (C/C++)[^] statement:
#pragma comment(lib, "lib-name")
You are on the right track, but it looks like you use the wrong library.
Take a look at the discussion at stackoverflow because they use antoher and additional libraries and on the original sample code from curl.
这篇关于我如何表明库和& 2015年MS visual studio社区中的头文件位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!