简体   繁体   中英

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? Basically I wan to generte .exe file by running the scource code in command prompt.

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. Getting started with OpenCV 2.4 and MinGW on Windows 7

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

Edit for 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. 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. https://www.visualstudio.com/en-us/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.

Alternatively, I did find some info on building the core from code using CMAKE. But it does not mention using MinGW. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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