0

I am going to be making a project with OpenCV and (probably) Qt for GUI and I was just wondering what kind of project I should create in visual studio? Would it be the Win32 Project or Win32 Console Application or just an Empty Project? A lot of them are quite obvious as I am not making a Dll or makefile but do not know the difference between the others. Thanks in advance.

Jay Bell
  • 77
  • 6
  • Well do you want to create a Console application or a GUI application? If it's GUI, then you'd start off with either an empty project or a Win32 project. I did however find http://stackoverflow.com/questions/7011238/opencv-2-3-c-visual-studio-2010?rq=1 which says to use Console. Maybe you should consult the OpenCV documentation? – RǢF Jan 12 '15 at 17:38
  • 2
    If you're using Qt, perhaps it would be simpler to use Qt Creator instead of VS? – Cameron Jan 12 '15 at 17:40
  • 1
    Use a Qt project (thats in a different tab within VS). Maybe you have to install the Qt plugin for VS first – Micka Jan 12 '15 at 17:40
  • Thanks you three, I will look more into it, RǢF I will look at the thing you linked, and yes when I setup OpenCV in VS it one step was create a console I just wasn't sure if I should do that for the whole project. Cameron I have not used Qt before but I figured I would just include it in my library so that I can use VS as my IDE. Micka awesome thanks I will do that, have yet to setup Qt in VS as I was going to do that today. – Jay Bell Jan 12 '15 at 17:48
  • You might want to consider generating your Qt project using cmake. There's a steep learning curve, but it makes things very easy once you get the hang of it, and no VS extensions required. – Nicolas Holthaus Jan 12 '15 at 19:40

2 Answers2

3

Which type of project you decide to pick in Visual Studio depends what will best fits your needs. Since I do not know your exact needs, the best answer I can give is explain the difference between the types of Project Options and give examples when you would choose to use the given project:

Win32 Project: A Win32 Project is one of the options Visual Studio provides to you, and if chosen will provide the user with template code that generates a "window", that window being just like any other window (browser window, folder window, etc), but one that your program controls.

Examples: Making a calculator, making an application that needs a window with buttons for the user to communicate with the program, etc.

Win32 Console Application: In this option, Visual Studio provides a Command Prompt interface where the user can input data and also where output can appear. Basically it's the black window where you can input commands and receive information of what is happening in your program.

Examples: When testing out code (it makes debugging easier in some cases), when the program really doesn't need to be too elaborate, etc.

There are other options available, thou these two were mentioned in your post and are probably the most popular among developers.

CodeBlocks
  • 233
  • 3
  • 5
  • 14
2

After installing Qt and maybe a Qt-VisualStudio-Plugin you have some new options when creating a New Project:

enter image description here

You should choose Qt Application in most cases. Not sure if you can use a GUI with Qt Console Application, but you'll get a terminal/console in that case.

After choosing project name, you can easily choose the Qt Modules you'll need. This adds them to your project settings, so you don't have to add the manually (but I guess you can do so later if you need more modules).

enter image description here

The project will create a .ui file which you can open/edit with QtDesigner. The project will perform all the moc and uic compile steps automatically and you don't have to add those things manually.

I think this is the easiest way to use the combination of Qt and Visual Studio.

Adding OpenCV to Visual Studio is easy: Just add the include directories and the correct OpenCV libraries.

The question whether to use a consolse application or not depends on your needs. Personally, I like printing development output to a console, but maybe you don't want that in your final project ;)

Micka
  • 19,585
  • 4
  • 56
  • 74