Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Error: C3861: 'spis_CreateInstance': identifier not found
Qt 6.11 is out! See what's new in the release blog

Error: C3861: 'spis_CreateInstance': identifier not found

Scheduled Pinned Locked Moved General and Desktop
30 Posts 2 Posters 19.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #3

    Thanks for the welcome and prompt reply!

    bq. Do you link properly to that lib ?

    I think so. Like I said, the source code works in a C++ console program.
    I'm not sure about linking, I just added all the lib, DLL and header files. I don't know what I'm supposed to do to link them other than adding
    @extern "C" {
    #include "SpiStorm.h"
    }@

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #4

      Did you add

      @LIBS += -lnameofyourlib@

      to your pro file ?

      If you are using QtCreator you can make it do the job for you

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #5

        N where should I put it?
        @#-------------------------------------------------

        Project created by QtCreator 2013-08-09T10:31:41

        #-------------------------------------------------

        QT += core gui

        greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

        TARGET = Not
        TEMPLATE = app

        SOURCES += main.cpp
        notepad.cpp
        ../../../../../../Users/fc8r7c/Desktop/DLL_Demo_ONSemi/DLL_Demo_ONSemi/DLL_Demo/DLL_Demo.cpp
        SpiStorm.cpp

        HEADERS += notepad.h
        ../../../../../../Users/fc8r7c/Desktop/DLL_Demo_ONSemi/DLL_Demo_ONSemi/inc/SpiStorm.h
        ../../../../../../Users/fc8r7c/Desktop/DLL_Demo_ONSemi/DLL_Demo_ONSemi/DLL_Demo/stdafx.h
        SpiStorm.h

        FORMS += notepad.ui

        OTHER_FILES +=
        ../../../../../../Users/fc8r7c/Desktop/DLL_Demo_ONSemi/DLL_Demo_ONSemi/lib/SpiStorm.lib
        ../../../../../../Users/fc8r7c/Desktop/DLL_Demo_ONSemi/DLL_Demo_ONSemi/DLL_Demo/SpiStorm.dll
        @

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #6

          I cleaned it up a little and here's what I have now.
          @#-------------------------------------------------

          Project created by QtCreator 2013-08-09T10:31:41

          #-------------------------------------------------

          QT += core gui
          LIBS += SpiStorm
          greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

          TARGET = Not
          TEMPLATE = app

          SOURCES += main.cpp
          notepad.cpp

          HEADERS += notepad.h
          SpiStorm.h

          FORMS += notepad.ui

          OTHER_FILES +=
          SpiStorm.dll
          SpiStorm.lib
          @

          Here's the header file
          @#ifndef SPI_STORM_C
          #define SPI_STORM_C

          #define EX __declspec(dllexport)

          extern "C"
          {
          EX int spis_CreateInstance(void);
          EX void spis_DeleteInstance(int Handle);
          EX void spis_SelectInstance(int Handle);

          EX int spis_ScanDev(unsigned char *pType, unsigned int *pID, unsigned char *pSerNum);
          EX int spis_Connect(char *pSerNum, unsigned short SupplyVoltage);
          EX int spis_Disconnect(void);
          EX int spis_SetDisconnectCallback(void *pObj, void *pFct);

          EX int spis_LoadPrjFile(char *pFileName, bool CheckSyntax, bool SetInitial);

          EX int spis_ExecProg(bool Blocking);
          EX int spis_ExecProgBuf(char **pBufOut, char **pBufIn, unsigned int NrBuf, bool Blocking);

          EX int spis_ExecMacro(char *pLabel,char *pBufOut, char *pBufIn);

          EX int spis_StartSequence(void);
          EX int spis_EndOfSequence(void);

          EX int spis_ExternalPowerSelected(bool *pSelected);
          EX int spis_ExternalClockPresent(bool *pPresent);

          EX int spis_Abort(void);

          EX int spis_GetState(void);
          EX int spis_SetStateCallback(void *pObj, void *pFct);

          EX int spis_SetSysErrCallback(void *pObj, void *pFct);
          };

          #endif SPI_STORM_C@

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #7

            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)

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #8

              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 gui

              greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

              TARGET = Not
              TEMPLATE = app

              SOURCES += main.cpp
              notepad.cpp

              HEADERS += notepad.h

              FORMS += notepad.ui

              INCLUDEPATH += .
              LIBS += -L$$PWD
              -lSpiStorm
              @

              Hope it helps

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • ? Offline
                ? Offline
                A Former User
                wrote on last edited by
                #9

                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()!

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #10

                  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

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • ? Offline
                    ? Offline
                    A Former User
                    wrote on last edited by
                    #11

                    Thanks, I'll try that on Monday.

                    1 Reply Last reply
                    0
                    • ? Offline
                      ? Offline
                      A Former User
                      wrote on last edited by
                      #12

                      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?

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #13

                        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

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0
                        • ? Offline
                          ? Offline
                          A Former User
                          wrote on last edited by
                          #14

                          I didn't think of that. I'll check my settings.
                          Thanks

                          1 Reply Last reply
                          0
                          • ? Offline
                            ? Offline
                            A Former User
                            wrote on last edited by
                            #15

                            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.

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #16

                              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 !

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              0
                              • ? Offline
                                ? Offline
                                A Former User
                                wrote on last edited by
                                #17

                                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

                                1 Reply Last reply
                                0
                                • SGaistS Offline
                                  SGaistS Offline
                                  SGaist
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #18

                                  Why do you put data in pDataOut ? Shouldn't be in pDataIn ?

                                  Interested in AI ? www.idiap.ch
                                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  1 Reply Last reply
                                  0
                                  • ? Offline
                                    ? Offline
                                    A Former User
                                    wrote on last edited by
                                    #19

                                    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.

                                    1 Reply Last reply
                                    0
                                    • SGaistS Offline
                                      SGaistS Offline
                                      SGaist
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #20

                                      So pDataOut is what goes to the SPI module and pDataIn is what the module sends ?

                                      Also, why the +1 ?

                                      Interested in AI ? www.idiap.ch
                                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                      1 Reply Last reply
                                      0
                                      • ? Offline
                                        ? Offline
                                        A Former User
                                        wrote on last edited by
                                        #21

                                        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.

                                        1 Reply Last reply
                                        0
                                        • ? Offline
                                          ? Offline
                                          A Former User
                                          wrote on last edited by
                                          #22

                                          My intent is to send a 4 byte command.

                                          1 Reply Last reply
                                          0

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt
                                          • Unsolved