[SOLVED] Can't add custom class!
-
Have you added the hex.cpp file to your project?
-
Yes.. hex.cpp is in the project tree.
-
Hi,
In the project tree doesn't mean it gets compiled. Do you list in the sources in your pro file ?
-
yes.. it was listed.
-
Can you show your pro file ?
-
@#-------------------------------------------------
Project created by QtCreator 2012-09-04T13:47:46
#-------------------------------------------------
QT += gui declarative
QT += core gui
#DEFINES +=QT_DISABLE_DEPRECATED_BEFORE=0x040800 #0x050100 to disable functions deprecated in Qt 5.1 and earlier
greaterThan(QT_MAJOR_VERSION, 4): QT += printsupportTARGET = MyApp
TEMPLATE = appSOURCES += main.cpp
mainwindow.cpp
hid_pnp.cpp
qcustomplot.cpp
windows/hid.c
hex.cppHEADERS += mainwindow.h
hid_pnp.h
qcustomplot.h
hidapi.h
hex.hFORMS += mainwindow.ui
#-------------------------------------------------
Add the Signal11's hidapi library that was
created
#-------------------------------------------------
macx: LIBS += -L../HIDAPI/mac -lHIDAPI
#win32: LIBS += -L../HIDAPI/windows -lHIDAPI
unix: !macx: LIBS += -L../HIDAPI/linux -lHIDAPI#-------------------------------------------------
Make sure to add the required libraries or
frameoworks for the hidapi to work depending on
what OS is being used
#-------------------------------------------------
macx: LIBS += -framework CoreFoundation -framework IOkit
win32: LIBS += -lSetupAPI
unix: !macx: LIBS += -lusb-1.0#-------------------------------------------------
Make sure output directory for object file and
executable is in the correct subdirectory
#-------------------------------------------------
macx {
DESTDIR = mac
OBJECTS_DIR = mac
MOC_DIR = mac
UI_DIR = mac
RCC_DIR = mac
}
unix: !macx {
DESTDIR = linux
OBJECTS_DIR = linux
MOC_DIR = linux
UI_DIR = linux
RCC_DIR = linux
}
win32 {
DESTDIR = windows
OBJECTS_DIR = windows
MOC_DIR = windows
UI_DIR = windows
RCC_DIR = windows
}@
-
I tried again.. and got the same error.
-
Did you delete the build directory and do a full rebuild ?
-
I just tried and no it doesn't work.
It should be so simple!
-
Are all your files in the same folder ?
-
Yes.. they are.
Thank you for your help by the way!
-
Are you also calling this function in hid_pnp ?
-
In hid_pnp.. I setup an instance of the class by using
CHexManager HexManager;
so calling HexManager.LoadHexFile(); in hid_pnp... will produce the error.
-
Then let's go step by step, comment all call to that function and build again, once it does, re-add them one by one.
-
THANK YOU!!!!
I got it... I don,t know why I did this. But I had included #include "hid_pnp.h" in my hex.c file.
Going to the strict minimum was a good idea.
-
You're welcome !
Since you have it working now, don't forget to update the thread title prepending [solved] so other forum users may know a solution has been found :)