OpenCV VS 2010 C++ CMake

发布于 2024-10-02 04:33:23 字数 3628 浏览 0 评论 0原文

我找不到这个可能很简单的问题的答案。我在使用 Dev C++ 或 VS 2010 让 OpenCV 在我的计算机上工作时遇到了问题。

我的问题不是关于具体细节,而是关于 CMake 对这个过程的贡献。

我已经完成了很多 C++ 程序,学习了这门语言。然而,我编写并编译了它们,没有大惊小怪,直接在 Dev C++ 上使用标准包含等。

现在我开始尝试使用我的第一个第 3 方库集,有一个下载可执行文件的巨大过程,使用 CMake,然后使用其中一种 IDE 进行编译。对我来说,事情出错也就不足为奇了。步骤太多,目的是什么?

好吧,所以我对编程很天真和简单。所以我的问题是:

如果之后必须执行三个步骤,为什么还要有可执行文件?如果作者不知道每个人都在使用什么编译器,我有点理解;但为什么不只是一组简单的源代码并用它来完成呢?

但是,如果有 VS 2010 的特定文件,为什么不让它按照在计算机上的工作方式进行设置?就像每个人都以相同格式下载 VS 2010,然后自行安装一样?

最后,即使需要某种安装程序来创建目录结构(我仍然不明白,因为 Zip、tar 等工作正常),为什么还需要 CMake?

我不介意因为愚蠢和遗漏一些明显的观点而被嘲笑,但我会很高兴不必费力地进行快速反驳:这对你们来说可能看起来很简单,但从外面来看,它没有多大意义。提前致谢,约翰,


谢谢。我想我对这个过程的细节了解不够,无法理解为什么这是必要的。或者更确切地说,我有点理解:有不同的操作系统和不同的编译器,但即使每个系统的编码不同,CMake 也理解它列出的编译器,因此开发人员只需要弄清楚如何为 CMake 编写即可。如果 CMake 不理解环境或编译器,则库作者或开发人员必须弄清楚如何将其移植到该特定环境。然而,我仍然不明白为什么对于 VS 2010 来说,因为 OpenCV 已经有了一个特定的编译器,所以 CMake 是必要的。不过,我暂时先不管它并继续前进。

再次感谢。


我想我需要添加一条评论。回答“这真的是一个大问题吗?”的问题。我认为答案是肯定的。我已经浪费了将近一周的时间试图让 OpenCV 与 VS 2010 一起工作。

从微软网站到独立博客,没有人能够帮助我。我已经经历过 sxstrace 等,并尝试了任何人建议的一切。最后还是同样的问题。

所以,是的,这确实是一个问题。我现在不想学习Windows编程。我现在也不想学习 CMake 的复杂性。为 Windows 安装的 .exe 程序一直对我有用。我确信有例外,但就我个人而言,没有例外。因此,如果 OpenCV 推出了一个特殊的 2008.exe 版本,为什么不让它一直正常工作呢。


顺便说一句,这是 sxstrace 文本文件的输出:

启动竞赛。 输入参数: 标志= 0 处理器架构 = x86 CultureFallBacks = it-IT;it ManifestPath = C:\Windows\system32\cxcore210d.dll 程序集目录 = C:\Windows\system32\ 应用程序配置文件 =

信息:corso 中的文件清单分析 C:\Windows\system32\cxcore210d.dll。 信息:宣言定义的身份 (null)。 信息:参考:Microsoft.VC90.DebugCRT,processorArchitecture =“x86”,publicKeyToken =“1fc8b3b9a1e18e3b”,type =“win32”,version =“9.0.21022.8” 信息:corso 中的 Microsoft.VC90.DebugCRT、processorArchitecture="x86"、publicKeyToken="1fc8b3b9a1e18e3b"、type="win32"、version="9.0.21022.8" 的解决方案。 信息:corso 中每个 ProcessorArchitecture x86 的解决方案。 信息:corso 中的中性语言 risoluzione del riferimento。 信息:corso 中绑定标准的应用。 信息:非 trovati 的标准。 信息:重新定义非 trovato 约束条件。 信息:从组装探测开始。 信息:在 WinSxS 中汇编非 trovato。 信息:尝试在 C:\Windows\Assembly\GAC_32\Microsoft.VC90.DebugCRT\9.0.21022.8__1fc8b3b9a1e18e3b\Microsoft.VC90.DebugCRT.DLL 中探测宣言。 信息:尝试在 C:\Windows\system32\Microsoft.VC90.DebugCRT.DLL 中探测宣言。 信息:尝试在 C:\Windows\system32\Microsoft.VC90.DebugCRT.MANIFEST 中探测宣言。 信息:尝试在 C:\Windows\system32\Microsoft.VC90.DebugCRT\Microsoft.VC90.DebugCRT.DLL 中探测宣言。 信息:尝试在 C:\Windows\system32\Microsoft.VC90.DebugCRT\Microsoft.VC90.DebugCRT.MANIFEST 中探测宣言。 INFORMAZIONI:宣言非中性语言。 信息: 很好的探测戴尔装配的安全措施。 信息:不可能解决 Microsoft.VC90.DebugCRT、processorArchitecture="x86"、publicKeyToken="1fc8b3b9a1e18e3b"、type="win32"、version="9.0.21022.8"。 错误:生成非 riuscita 竞赛。 优秀的生成竞赛。

这是调试输出。

“Hello Saturday Night.exe”:已加载“C:\Users\jake\Documents\Visual Studio 2010\Projects\Hello Saturday Night\Debug\Hello Saturday Night.exe”,已加载符号。 “Hello Saturday Night.exe”:已加载“C:\Windows\System32\ntdll.dll”,已加载符号(已删除源信息)。 “Hello Saturday Night.exe”:已加载“C:\Windows\System32\kernel32.dll”,已加载符号(已删除源信息)。 “Hello Saturday Night.exe”:已加载“C:\Windows\System32\cxcore210d.dll”,无法找到或打开 PDB 文件 调试器:: 在进程加载期间抛出未处理的不可继续异常 线程“Win32 Thread”(0x1140)已退出,代码为-1072365566(0xc0150002)。 线程“Win32 Thread”(0xf1c) 已退出,代码为 -1072365566 (0xc0150002)。 程序“[3688] Hello Saturday Night.exe: Native”已退出,代码为 -1072365566 (0xc0150002)。

I couldn't find the answer to this probably simple question. I have been having problems getting OpenCV to work on my computer with either Dev C++ or VS 2010.

My question is not about the specifics but instead is about what CMake contributes to the process.

I have worked my way through a lot of C++ programs, learning the language. However, I wrote them and compiled them, no fuss, directly on Dev C++ using the standard includes, etc..

Now wehn I come to try to use my first 3rd party set of libraries, there is this huge process of downloading an executable, using CMake, then compiling with one of the IDEs. To me, there is no wonder the thing goes wrong. Too many steps and for what purpose?

Ok, so I am naive and simple about programming. So here are my questions:

Why is there an executable if you have to do three steps afterwards? I sort of understand if the writers have no idea what compiler everyone is using; but why not just a simple set of source codes and be done with it?

However, if there is a specific file for VS 2010, why not just have it set itself up exactly the way it will work on the computer?, the same way that everyone downloads VS 2010 in the same format and then it installs itself?

Finally, even if some sort of installer is needed to create directory structure (which I still don't understand since Zip, tar, etc. work fine), why is there a need for CMake at all?

I don't mind being laughed at for being stupid and missing some obvious points, but I would appreciate not having to wade through quick retorts: it may seem simple to y'all but from the outside, it doesn't make much sense. Thanks in advance, john


Thanks. I guess I don't understand enough about the details of the process to understand why this is necessary. Or rather, I sort of understand: there are different operating systems and different compilers, but even though the coding is different for each, CMake understands the compilers that it has listed and so a developer only need figure out how to write for CMake. If CMake doesn't understand the environment or compiler, the library authors or the developer has to figure out how to port it to that particular environment. However, I still don't understand why for the case of VS 2010, since OpenCV already has a particular compiler in mind, that CMake is necessary. However, I will just leave that alone for the moment and move on.

Thanks again.


I think I need to add a comment. In response to the question "Is it really that much of an issue?" I think the answer has to be yes. I have wasted almost a week trying to get OpenCV to work with VS 2010.

No one, from the microsoft websites to the independent blogs has been able to help me. I have gone through sxstrace, etc. and tried everything anyone has suggested. In the end it is the same problem.

So yes it really is an issue. i am not trying to learn windows programming at this moment. Nor do i want to learn CMake intricacies at this time. The .exe programs that install for windows have always worked for me. I am sure there are exceptions but personally there aren't. So if OpenCV is putting out a special 2008.exe version, why not just make it work all the way.


By the way, here is the output of the sxstrace text file:

Inizio generazione contesto di attivazione.
Parametro di input:
Flags = 0
ProcessorArchitecture = x86
CultureFallBacks = it-IT;it
ManifestPath = C:\Windows\system32\cxcore210d.dll
AssemblyDirectory = C:\Windows\system32\
Application Config File =

INFORMAZIONI: analisi del file manifesto C:\Windows\system32\cxcore210d.dll in corso.
INFORMAZIONI: l'identità di definizione del manifesto è (null).
INFORMAZIONI: riferimento: Microsoft.VC90.DebugCRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8"
INFORMAZIONI: risoluzione del riferimento Microsoft.VC90.DebugCRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8" in corso.
INFORMAZIONI: risoluzione del riferimento per ProcessorArchitecture x86 in corso.
INFORMAZIONI: risoluzione del riferimento per la lingua Neutral in corso.
INFORMAZIONI: applicazione dei criteri di binding in corso.
INFORMAZIONI: criteri di autore non trovati.
INFORMAZIONI: reindirizzamento criteri di binding non trovato.
INFORMAZIONI: inizio dell'esecuzione del probe dell'assembly.
INFORMAZIONI: assembly non trovato in WinSxS.
INFORMAZIONI: tentativo di esecuzione del probe del manifesto in C:\Windows\assembly\GAC_32\Microsoft.VC90.DebugCRT\9.0.21022.8__1fc8b3b9a1e18e3b\Microsoft.VC90.DebugCRT.DLL.
INFORMAZIONI: tentativo di esecuzione del probe del manifesto in C:\Windows\system32\Microsoft.VC90.DebugCRT.DLL.
INFORMAZIONI: tentativo di esecuzione del probe del manifesto in C:\Windows\system32\Microsoft.VC90.DebugCRT.MANIFEST.
INFORMAZIONI: tentativo di esecuzione del probe del manifesto in C:\Windows\system32\Microsoft.VC90.DebugCRT\Microsoft.VC90.DebugCRT.DLL.
INFORMAZIONI: tentativo di esecuzione del probe del manifesto in C:\Windows\system32\Microsoft.VC90.DebugCRT\Microsoft.VC90.DebugCRT.MANIFEST.
INFORMAZIONI: manifesto non trovato per la lingua Neutral.
INFORMAZIONI: fine dell'esecuzione del probe dell'assembly.
INFORMAZIONI: impossibile risolvere il riferimento Microsoft.VC90.DebugCRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8".
ERRORE: generazione del contesto di attivazione non riuscita.
Fine generazione contesto di attivazione.

Here is the debug output.

'Hello Saturday Night.exe': Loaded 'C:\Users\jake\Documents\Visual Studio 2010\Projects\Hello Saturday Night\Debug\Hello Saturday Night.exe', Symbols loaded.
'Hello Saturday Night.exe': Loaded 'C:\Windows\System32\ntdll.dll', Symbols loaded (source information stripped).
'Hello Saturday Night.exe': Loaded 'C:\Windows\System32\kernel32.dll', Symbols loaded (source information stripped).
'Hello Saturday Night.exe': Loaded 'C:\Windows\System32\cxcore210d.dll', Cannot find or open the PDB file
Debugger:: An unhandled non-continuable exception was thrown during process load
The thread 'Win32 Thread' (0x1140) has exited with code -1072365566 (0xc0150002).
The thread 'Win32 Thread' (0xf1c) has exited with code -1072365566 (0xc0150002).
The program '[3688] Hello Saturday Night.exe: Native' has exited with code -1072365566 (0xc0150002).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

花间憩 2024-10-09 04:33:23

我认为您可能会误解谁 CMake 受益最大。这是图书馆的作者,这是有充分理由的。当您编写跨平台库时,您需要为不同的操作系统和编译器提供构建环境。有相当多的组合。维护大型库项目的这些 make 文件和项目/解决方案是一项劳动密集型任务,特别是在添加或删除新文件的情况下。

CMake 消除了这个痛苦。它以独立于编译器的方式生成构建,允许源代码的作者维护单个构建环境。现在该项目可以轻松地跨平台和编译器分发。

所以,是的,对于使用该库的开发人员来说,这是一个额外的步骤,但您只需在每个版本中构建一次,这真的是一个大问题吗?

I think you might misunderstand who CMake benefits the most. It's the library authors, and for good reason. When you are authoring a cross-platform library, you need to provide build environments for the different operating systems and compilers. There are quite a few combinations. Maintaining these make-files and projects/solutions for large library projects is a labour-intensive task, especially if a new file has been added or removed.

CMake takes the pain out of this. It generates a build in a compiler-independent-manner, allowing the authors of the source code to maintain a single build environment. Now the project can be distributed across platforms and compilers easily.

So yes, it's an extra step for the developer using the library, but you only have to build it once-per-release, is it really that much of an issue?

深爱成瘾 2024-10-09 04:33:23

除了 Moo-Juice 所说的一切之外,如果您想要一个简单的 VS 计算机视觉解决方案,我强烈推荐 EmguCV。它是 C# 包装器中的 OpenCV。没有 Make 文件,总体来说更容易处理,特别是如果您是新手。

In addition to everything Moo-Juice said, if you want an easy computer vision solution for VS I would highly recommend EmguCV. It is OpenCV in a C# wrapper. No Make file and overall much easier to handle, especially if you are a novice.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文