Starting with QT - source and header files
-
Hello
I have started learning QT from scratch by myself, as well as C++ and I don't have much experience. I am using the documentation but it's also sometimes complicated and doesn't clear everything.
What I haven't found anywhere, is the explanation about the source and header files. How are they connected? What should I write where?
Sorry for the dumb question but it would really help me now. -
Hello
I have started learning QT from scratch by myself, as well as C++ and I don't have much experience. I am using the documentation but it's also sometimes complicated and doesn't clear everything.
What I haven't found anywhere, is the explanation about the source and header files. How are they connected? What should I write where?
Sorry for the dumb question but it would really help me now.basically you put the declarations in the headers (so that other files can refer to these declarations) and you implement the details in the sources.
When discovering new stuff I rather recommend that you go on tutorials rather than documentation, they don't replace each other. While a good documentation lists all the details, the tutorial rather focuses on the essentials.
What I recommend you is find some beginner's C++ tutorial first (you fill find many on the web or many videos on youtube, at your convenience).
-
Hello
I have started learning QT from scratch by myself, as well as C++ and I don't have much experience. I am using the documentation but it's also sometimes complicated and doesn't clear everything.
What I haven't found anywhere, is the explanation about the source and header files. How are they connected? What should I write where?
Sorry for the dumb question but it would really help me now.Hi and welcome,
this is indeed very basic C++. You should learn that first (or while learning Qt) otherwise you will have a hard time learning and understanding Qt C++.
Header and source files are there because of multiple things.
It helps to organize your code and separates your implementation of classes and function from their declaration.
As you might have seen, this is just a "standard". You might come across short programs, which only have amain.cpp
, where everything is declared and used. Themain.cpp
is the main entry point for your C++ program.How are they connected?
You
#include <test.h>
your header in yourtest.cpp
to use the function declared there.This article may help