How can I test out header files and related C++ source code?
-
I try to add new function for my Qt program with CPP and header file. But I'm not quite sure if I get it right. Like to test it out on Qt Creator, but errors and warnings keeps popping up. I don't know what I I've done wrong.
header:
#include <QApplication>
#include <QObject>
#include <QWidget>
#include <QString>
#include <iostream>#ifndef TEST_H
#define TEST_Hclass test{
public:
static bool check(const QString& data);
static void run;
public:
static unsigned char* pTr = NULL;
} -
Hi and welcome.
I added some comment to the code to show the changes to make it compile.
I wonder if you are aware of using static in classes has a completely other meaning than
in good old C.
http://www.tutorialspoint.com/cplusplus/cpp_static_members.htm
:)#ifndef TEST_H #define TEST_H class test{ public: static bool check(const QString& data); static void run(); <------------- must have () when function public: static unsigned char* pTr = NULL; }; <---- must end with ; #endif <----- was missing
-
@rogerloh4.0 said:
errors and warnings keeps popping up. I don't know what I I've done wrong.
Read the error messages. They tell you what's wrong.