即使没有添加任何搜索路径,代码块也如何找到我的头文件 [英] How can Codeblocks find my header files even without adding any search paths

查看:180
本文介绍了即使没有添加任何搜索路径,代码块也如何找到我的头文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习在代码块中使用OpenCV(和C ++).但是,令我感到困惑的是,当我开始在我的main.cpp文件中包含来自OpenCV的头文件时,Codeblocks会自动向我建议这些文件,如下图所示.

I'm learning to use OpenCV (and C++) in Codeblocks. What confuses me, however, is that when I start to include header files from OpenCV in my main.cpp file, Codeblocks automatically suggests to me the files as shown in the image below.

我没有为项目构建选项提供任何搜索路径,那么Codeblocks怎么可能找到文件?还有其他我不知道的变量在起作用吗?

I have not included any search paths to project build options, so how is this possible that Codeblocks can find the files? Is there some other variable working here that I'm unaware of?

请注意,我是同时使用Codeblocks和OpenCV的初学者,并且我对C ++仅有一点经验.

Note that I'm a beginner with both Codeblocks and OpenCV and that I only have a little experience with C++.

谢谢

推荐答案

当然,当您默认安装code::blocks之类的IDE时,它会知道OS上库的标准路径.

Of course when you install an IDE like code::blocks by default, it knows about standard path for library on your OS.

在我的OS-> Ubuntu上是/usr/include

它仅在标准路径上搜索,除非您添加了一个.如果通过命令行安装库,则它将转到标准位置;如果是手动安装,则取决于添加到安装中的选项.我看不到您的屏幕截图,但是默认情况下它可以访问/usr/include.

It only searches on a standard path, except you add one. If you install your library by command-line, it goes to the standard place, if you installed manually, then it depends on your option you added to installation. I can not see you screen-shot but it has access to /usr/include by default.

有关Linux和OpenCV的更多详细信息

这是Ubuntu上的代码块的屏幕截图,我添加了一些第三方库

And here is a screen-shot of codeblock on Ubuntu that I added some 3rd-party library

注意:
如果您通过命令行安装任何库,请使用它.
但是,如果您手动安装它们,则需要在代码块中添加2个内容.
1.首先是header文件
的路径 2.其次是您linker

NOTE:
if you install any libraries by command-line, just use it.
But if you have installed them manually, you need to add 2 things to codeblock.
1. First is your path for header file
2. Second is your path for linker

您会在屏幕截图中看到以下内容:搜索目录

And you see it in screen-shot that say: Search Directory

第一个用于header,第二个用于linker

First is for header and second is for linker

这篇关于即使没有添加任何搜索路径,代码块也如何找到我的头文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆