Hi there!
Just started with c++, this is my first programming language.
I'm trying to follow the Pluralsight tutorial with Kate Gregory.
I'm using QT creator as IDE.
I'm trying to call a function but I'm doing something wrong. I'm using QTcreator as IDE.
What I want to do is to call the loop to main from an other .cpp file.
What would be the proper way to call the loop in the loader.cpp to main.cpp?
I'm currently getting
1 2 3 4
[code]
error: 'loader' cannot be used as a function
int injectload = loader ();
[/code}
==============
head.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#ifndef HEAD
#define HEAD
#include <QCoreApplication>
#include <iostream>
#include <QTest>
#include <QNetworkInterface>
int b;
int c;
int loader;
#endif // HEAD
I'm sorry, i edited some before you posted.
I changed the header file to this:
1 2 3 4 5 6 7 8 9 10 11 12 13
#ifndef HEAD
#define HEAD
#include <QCoreApplication>
#include <iostream>
#include <QTest>
#include <QNetworkInterface>
int b;
int c;
loader(argc, argv);
#endif // HEAD
I'm still getting error:
1 2
main.cpp:12:18: error: 'loader' cannot be used as a function
loader(argc, argv);
I fixed it!..it think. It runs without any compiler error at least.
Thanks Moschops. :D
I did not understand the reason of header file until know.
So it seems to function as a linker-index?
head.h
1 2 3 4 5 6 7 8 9 10 11
#ifndef HEAD
#define HEAD
#include <QCoreApplication>
#include <iostream>
#include <QTest>
int loader();
#endif // HEAD