Error: C3861: 'spis_CreateInstance': identifier not found
-
I added stdafx.cpp and stdafx.h and now I get a different error.
notepad.obj:-1: error: LNK2019: unresolved external symbol spis_CreateInstance referenced in function "private: void __cdecl Notepad::on_quithButton_clicked(void)" (?on_quithButton_clicked@Notepad@@AEAAXXZ) -
stdafx ? From a Qt app ? You should not have them at all.
Anyway, you have your external lib in the same folder as the sources so your pro file should rather contain something like this:@
QT += core guigreaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Not
TEMPLATE = appSOURCES += main.cpp
notepad.cppHEADERS += notepad.h
FORMS += notepad.ui
INCLUDEPATH += .
LIBS += -L$$PWD
-lSpiStorm
@Hope it helps
-
That didn't help.
Here is a screen shot if that helps.
!https://lh6.googleusercontent.com/-vp-_tlFBaRg/UgVMrpZ-QiI/AAAAAAAAKNk/4_gR_M18Slc/s800/Qt5capture.JPG()! -
Strange...
Can you try to add this ?@QMAKE_LFLAGS += /OPT:NOREF@
I don't have a Window computer handy right now so I can't test the lib
-
Thanks, I'll try that on Monday.
-
That didn't help. This is frustrating. I feel like I'm right on the edge of getting this to work but I don't know how to tell this program where the library is or something as simple as that. Any more ideas? Have you looked at the file tree and is it setup right?
-
Just to be sure, are you building your Qt application in 32 or 64 bit ? SpiStorm seems to be 32
Also no need for the NOREF line
-
I didn't think of that. I'll check my settings.
Thanks -
So how do I change it?
While I'm waiting, I'm downloading the 32Bit version of Qt and I hope to be able to run in either version without uninstalling the 64Bit version. -
Simple:
Add the Qt you just installed to the Qt version
Make a kit with it
Change the kit for your project
Build and run !
-
I have a new related problem. I get past all the code up to adding my data. I get junk in the pDataOut.
This should be an easy one right. Fingers crossed.@if (Res == 0) {
char *pDataOut = (char *)malloc(6);
char *pDataIn = (char *)malloc(6);for (int i=0; i<4; i++) { *(pDataOut+i) = ((i%2)==0) ? 0xAA : 0x00; *(pDataIn+i) = 0; } if (Res == 0) { printf("Adding macro Data32..."); Res = spis_ExecMacro("Data32", pDataOut+1, pDataIn+1); if (Res != 0) { printf("Macro Data32 failed!\n"); } else { printf("done\n"); } } delete pDataOut; delete pDataIn; }@
Here's the debug info
Locals
Res -2142240767 int
SpiHandle -2147155967 int
i 4 int
pDataIn @0x265d760 "" char *
*pDataIn 0 '\0' char
pDataOut "ª\000ª" @0x3cbfd4 char *
*pDataOut -86 / 170 char
pPojectFileName "C:\Spi_StormProjects\24_BIT_Command.ssp" @0x3cbfcc char *
*pPojectFileName 67 'C' char
this @0x3cf7b8 Notepad *
QMainWindow class QMainWindow QMainWindow
QWidget class QWidget QWidget
staticMetaObject <Value unavailable error>
staticMetaObject struct QMetaObject QMetaObject
ui @0x869350 Ui::Notepad *
Inspector
Expressions
Return Value
Tooltip -
Why do you put data in pDataOut ? Shouldn't be in pDataIn ?
-
This is part of an example console program that worked as such. Maybe I should run that program in debug mode and see what it's sending. I'm sending data out of my PC to a SPI module which transfers these bits at 50MHz to a custom test fixture.
-
So pDataOut is what goes to the SPI module and pDataIn is what the module sends ?
Also, why the +1 ?
-
So pDataOut is what goes to the SPI module and pDataIn is what the module sends ? Yes, pDataIn reads back from the module.
Also, why the +1 ? I have no idea.
-
My intent is to send a 4 byte command.
-
It's getting strange, the 4byte command is stored in a 6byte array, the command start at 0 but you send starting at byte 1.
Sounds dubious...
-
Well I did clip a lot of the original code and just use what I thought I would need. I ran the console program without the +1s and changed the mallocs 2to 4. This seems to work great in the console program but again, not in the Qt5. Grrr.
@ if (Res == 0) {
char *pDataOut = (char *)malloc(4);
char *pDataIn = (char *)malloc(4);for (int i=0; i<4; i++) { *(pDataOut+i) = ((i%2)==0) ? 0xFA : 0x02; *(pDataIn+i) = 0; } if (Res == 0) { printf("Adding macro Data32..."); Res = spis_ExecMacro("Data32", pDataOut, pDataIn); if (Res != 0) { printf("failed!\n"); } else { printf("done\n"); }
@
-
If you are clipping too much code, you might be missing some initialization step or something
-
I don't have any errors but I can't get past this if statement so I'm not connecting through the DLL for some reason. Where is the disconnect from the button to the DLL? The code is the same and it should work. I've even added the conio and stdio include files. This is really strange.
@ int Res = 0;
int SpiHandle = spis_CreateInstance();
Res = spis_Connect("050112020E7", 3300);if (Res == 0) {@