简体   繁体   English

如何在Windows10的命令提示符下为opencv 3.0 c ++程序生成.exe?

[英]How to generate .exe for opencv 3.0 c++ program from command prompt in windows10?

How to generate(compile) .exe for opencv 3.0 c++ program from command prompt in windows10? 如何在Windows10的命令提示符下为opencv 3.0 c ++程序生成(编译).exe? Basically I wan to generte .exe file by running the scource code in command prompt. 基本上我想通过在命令提示符下运行scource代码来生成.exe文件。

It really depends on the compiler you are using. 这实际上取决于您使用的编译器。 If I go on the assumption you are looking to compile with MinGW on Windows Check out this thread for exact step by step instructions... Its for windows 7 but with updated downloads the steps should be very, very close. 如果我假设您要在Windows上使用MinGW进行编译,请查看此线程以获取准确的分步说明...对于Windows 7,但具有更新的下载,步骤应该非常非常接近。 Getting started with OpenCV 2.4 and MinGW on Windows 7 Windows 7上的OpenCV 2.4和MinGW入门

But the exact command would be something like this... g++ -I"C:\\opencv\\build\\include" L"C:\\opencv\\build\\x86\\mingw\\lib" loadimg.cpp -lopencv_core243 -lopencv_highgui243 -o loadimg Replace loadimg for your files 但是确切的命令应该是这样的... g ++ -I“ C:\\ opencv \\ build \\ include” L“ C:\\ opencv \\ build \\ x86 \\ mingw \\ lib” loadimg.cpp -lopencv_core243 -lopencv_highgui243 -o loadimg替换文件的loadimg

Edit for OpenCV 3.0 编辑OpenCV 3.0

So I did a little more looking (haven't used 3.0) and it appears the most common way is to use Visual Studio - http://docs.opencv.org/2.4/doc/tutorials/introduction/windows_visual_studio_Opencv/windows_visual_studio_Opencv.html?highlight=build I would recommend this approach if possible. 因此,我做了一些尝试(还没有使用过3.0),看来最常见的方法是使用Visual Studio- http://docs.opencv.org/2.4/doc/tutorials/introduction/windows_visual_studio_Opencv/windows_visual_studio_Opencv.html ?highlight = build如果可能的话,我会推荐这种方法。 It's the supported way and has good documentation. 这是受支持的方式,并且具有良好的文档记录。 If you need a copy of Visual Studio - the community edition is free for up to five users. 如果您需要Visual Studio的副本-社区版最多可免费提供五个用户。 https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx . https://www.visualstudio.com/zh-CN/products/visual-studio-community-vs.aspx Also you can use MSBUILD https://msdn.microsoft.com/en-us/library/f35ctcxw.aspx to compile the program from the command line. 您也可以使用MSBUILD https://msdn.microsoft.com/zh-cn/library/f35ctcxw.aspx从命令行编译程序。

Alternatively, I did find some info on building the core from code using CMAKE. 另外,我确实找到了一些有关使用CMAKE从代码构建内核的信息。 But it does not mention using MinGW. 但是它没有提到使用MinGW。 http://docs.opencv.org/2.4/doc/tutorials/introduction/windows_install/windows_install.html#cpptutwindowsmakeown . http://docs.opencv.org/2.4/doc/tutorials/introduction/windows_install/windows_install.html#cpptutwindowsmakeown There does seem to be a lack of information on the this topic though. 但是,似乎确实缺少有关此主题的信息。

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

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