Opening Qt c++ project - c++

I got a c++ gui project, but I only have .exe and .dll files. Is it possible to use Qt to modify this project? I suppose I'll need to get the .cpp and .h files in order to modify the project. Am I right? Thank you.

You need source files, i.e., .cpp and .h files to modify the project. You cannot directly modify executables or DLLs using Qt.

Is it possible to use Qt to modify this project?
Qt is a GUI framework, or C++ GUI library, not an IDE or editor. You can't use Qt to modify something.
You can do the following things with any IDE or editor:
modify the project configuration file .pro to change project
settings.
modify the use interface file .ui(with Qt designer for
convenience) to change UI.
modify the source file .cpp .h to change the logic of your
program.
with only .exe and .dll, you can add source file with code
directly accessing .dll with Windows API.

Related

How to connect single.c/.h files to cmake project?

So, I'm new to cmake and have some troubles. I have simple cmake project that contains a few .h and .c files. I've searched C code at github which consists of only one .h and one .c files. And i want to use some functions from this pack, but i don't want to put this file in my project directory. I want to keep them somewhere outside the project directory. So, how to connect them to project, how to make header visible for project and use #include "name.h" for watching and
and using available C functions .c/.h pack in my project.
Create some other directory in your project, such as misc/ and put the files there. Then use it in your code via "/misc/name.h"

How do I import my makefile project into QtCreator?

I have previously written a large C++ server and client project (containing multiple .cpp's and .h's which run with makefile). Now I want to modify the client to use a graphical user interface.
Should I import all of my codes to Qtcreator and compile them all in the software? How can I implement the makefile then?
Next, how can I modify my client so that the interfaction with the server is controlled from the graphical interface?
Create a Qt project (I guess, you need Qt Widgets application). Copy your existing files into project's directory. Import all these files to your project. Then look what you have to do in main() function. In Qt project it will be in the file main.cpp, and a minimal code for main() will be automatically created by Qt Creator. So, move the necessary code from your main() function there. Then bit by bit look which parts of your code will interact with Qt. Makefile will be created by Qt Creator. Files mainwindow.cpp and mainwindow.h relate to your main window's GUI.
QtCreator supports working with makefile projects. Basically it becomes a glorified text editor and directly invokes make for your project directory. Some features, like compiling a particular file might not work. See this SO question for more details. And then one can manually link/include Qt for your application's GUI.
Project configuration that is natively supported by QtCreator are qmake files. It converts directly into makefiles. This will provide the best QtCreator experience. So another option would be to convert your makefiles into qmake .pro/.pri files. This will require some effort.
I digress, but if you are going to go this way, I can also recommend CMake. QtCreator has on okay (and constantly improving) support for CMake. So do some other IDEs (CLion, VS). And you will always have the option to convert your CMake files into makefiles, Ninja files, VS solution, or even XCode project.

How do I know if a project is MFC application

My friend has given me a visual studio project , with lots of files.
I know for sure that it is C++ application.
But I want to verify that if it is an MFC application or not.
The issue is since this project has been developed on a higher version (VS 2013) than mine (VS 2010), it is not opening in VS 2010.
So I thought I will make a new project and then gradually add these files.
But When I try to make a new project , I have many options to choose , such as MFC, win32 etc.
I guess it is an MFC application. But to be sure I want to verify that this project is indeed an MFC application. How do I do this ? Especially by just looking at the project files!
Look into your source files and check if afx.h or afxwin.h is included any where.
Project Settings are secondary. Only if such a Header file is used in the Project the MFC libraries are included in the link phase.
You would probably be better off checking the source files, not the project file. For sure, the MFC library need to be present in the project file, but that option could have been left on accidentally.
You could search the source files for CWinApp, which is the class MFC applications need to be derived from. Also, you could try this page on MSDN, which will give you some idea about source and header files typically found in an MFC project.
VS2010 and VS2013 uses XML for .sln/.vcxproj files. Just create a minimal solution in VS2010. Then use a good text editor or even a file comparer to adjust settings inside the .vcxproj.
Great syntax changes occurred between VS2008 and VS2010. But since then most XML tags were kept unchanged between VS2010 and VS2013.

How do I share C++ source code files between projects in Visual Studio?

I'm writing a cross-platform application. One version will work under Win32 and the second on Windows Phone.
I'd like to reuse my C++ core - especially that there are no platform dependencies inside, STL only. I order to do so, I want to use the same source files in two projects: static Win32 library (.lib) and Windows Phone Component (C++/CLI).
How can I configure these two projects to use exactly the same source and header files?
OK, let's take an example. Let's say, that I have project:
MyApp.Library [win32 lib]
myClass.cpp
myClass.h
This library is compiled to .DLL file and then imported in a Win32 application:
MyApp.Win32App [win32 C#]
Since Win32 is not compatible with Windows Phone on the binary level, I cannot use that library directly. But since the library uses only STL, I can create a Windows Phone component, put all its sources there, and build.
MyApp.Component [Windows Phone component]
myClass.cpp
myClass.h
I want these two files to be exactly the same ones as used in the library. How should I organize the project to achieve this effect?
You can add source code from a common location to multiple projects. I do that a lot; I have code in a common directory that is at the same level in the directory hierarchy as most of my project files. It's simply a matter of adding .h and .cpp files from the common directory to your various projects.
I did notice that VisualStudio gets a little cranky and difficult if you use a network drive for common source, so I don't do that. But so long as all of your source code is on local disks, and the IDE knows where to find them, there is no problem having the same source file in very many projects.
one way is to put all .hpp and .cpp files into a seperate folder - call it "Shared".
Then add an additional include Directory inside your solution configuration property - this directory must be a relative path.
Then add ONLY the .cpp files relative from that shared folder into your project
NB! If you have include "stdafx.h" inside your .cpp files in the Shared folder, then comment those out.

Can you use a .exe project as a library in another project in the same solution?

As title says. I'm adding a project to an existing open source solution and would like to use some of the functionality of its .exe tools in my project. I added it as a reference and added its directory to additional includes but I cant seem to include its header file.