Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • 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.5k 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
    #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
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #23

            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...

            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
              #24

              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"); }
              

              @

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

                If you are clipping too much code, you might be missing some initialization step or something

                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
                  #26

                  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) {@

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

                    Since you have that example that works fine, did you try to simply get the "whole" code from it and put it in a function that you would call in your program ?

                    Then you can try to clean it and remove what you don't need

                    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
                      #28

                      I added the code to the main.cpp. Still doesn't open the console view. Seems like Qt5 doesn't want to open console programs.

                      @#include "notepad.h"
                      #include <QApplication>
                      #include <conio.h>
                      #include <malloc.h>
                      #include <direct.h>
                      #include <stdio.h>
                      extern "C" {
                      #include "SpiStorm.h"
                      }
                      int main(int argc, char *argv[])
                      {
                      QApplication a(argc, argv);
                      Notepad w;
                      w.show();
                      int Res = 0;

                      //
                      // Welcome message
                      //
                      printf("\nStarting DLL demo...\n\n");
                      
                      //
                      // Open the SPI Storm library and retrieve handle
                      //
                      printf("Opening the SPI Storm library and retrieve handle...");
                      int SpiHandle = spis_CreateInstance();
                      printf("done\n\n");
                      
                      //
                      // Connect to a SPI Storm device
                      //
                      //char SerNum[256];
                       Res = spis_Connect("050112020E7", 3300);
                      if (Res != 0) { printf("Serial Number failed!\n"); }
                      else { printf("done\n"); }
                      
                      
                      ///////////////////////////
                      // Load SPI project file //
                      ///////////////////////////
                      if (Res == 0) {
                         char *pPojectFileName = "C:\\Spi_StormProjects\\24_BIT_Command.ssp";
                         printf("\nLoading SPI configuration file \"%s\"...", pPojectFileName);
                         Res = spis_LoadPrjFile&#40;pPojectFileName, false, true&#41;;
                         if (Res != 0) { printf("failed!\n"); }
                         else { printf("done\n"); }
                      }
                      
                      //
                      // Burst the macros
                      //
                      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) ? 0x00 : 0x02;
                            *(pDataIn+i) = 0;
                         }
                      
                        /* printf("Initialise the burst sequence...");
                         Res = spis_StartSequence();
                         if (Res != 0) { printf("failed!\n"); }
                         else { printf("done\n"); }*/
                      
                         if (Res == 0) {
                            printf("Adding macro Data32...");
                            Res = spis_ExecMacro("Data32", pDataOut, pDataIn);
                            if (Res != 0) { printf("failed!\n"); }
                            else { printf("done\n"); }
                         }
                      
                        /* if (Res == 0) {
                            printf("Adding macro B5P0...");
                            Res = spis_ExecMacro("B5P0", pDataOut+1, pDataIn+1);
                            if (Res != 0) { printf("failed!\n"); }
                            else { printf("done\n"); }
                         }
                      
                         if (Res == 0) {
                            printf("Adding macro B6P0...");
                            Res = spis_ExecMacro("B6P0", pDataOut+2, pDataIn+2);
                            if (Res != 0) { printf("failed!\n"); }
                            else { printf("done\n"); }
                         }
                      
                         if (Res == 0) {
                            printf("Adding macro B1P0...");
                            Res = spis_ExecMacro("B1P0", pDataOut+3, pDataIn+3);
                            if (Res != 0) { printf("failed!\n"); }
                            else { printf("done\n"); }
                         }
                      
                         if (Res == 0) {
                            printf("Adding macro B2P0...");
                            Res = spis_ExecMacro("B2P0", pDataOut+4, pDataIn+4);
                            if (Res != 0) { printf("failed!\n"); }
                            else { printf("done\n"); }
                         }
                      
                         if (Res == 0) {
                            printf("Adding macro B3P0...");
                            Res = spis_ExecMacro("B3P0", pDataOut+5, pDataIn+5);
                            if (Res != 0) { printf("failed!\n"); }
                            else { printf("done\n"); }
                         }
                      
                         printf("Execute the burst sequence...");
                         Res = spis_EndOfSequence();
                         if (Res != 0) { printf("failed!\n"); }
                         else { printf("done\n"); }*/
                      
                         delete pDataOut;
                         delete pDataIn;
                      }
                      
                      //
                      // Close the SPI Storm library
                      //
                      printf("\nClosing the SPI Storm library...");
                      spis_DeleteInstance(SpiHandle);
                      printf("done\n");
                      
                      //
                      // Wait for user input to close the window
                      //
                      printf("\nPress any key...\n");
                      //int ch = _getch();
                      
                      
                      return a.exec&#40;&#41;;
                      

                      }
                      @

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

                        I get this output when I run it. The serial number is fine, it must be getting scrambled somehow.
                        Starting DLL demo...

                        Opening the SPI Storm library and retrieve handle...done

                        Serial Number failed!

                        Closing the SPI Storm library...done

                        Press any key...

                        The program has unexpectedly finished.
                        C:\Qt\Qt5.1.0\Tools\QtCreator\bin\build-Not-Desktop_Qt_5_1_0_MSVC2012_32bit-Debug\debug\Not.exe exited with code -2147155967

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

                          Gui applications don't open a command line (unless you add CONFIG += console), but you should have the output shown in the "Application output" panel in QtCreator

                          @/* printf("Initialise the burst sequence...");
                          Res = spis_StartSequence();
                          if (Res != 0) { printf("failed!\n"); }
                          else { printf("done\n"); }*/

                            /*printf("Execute the burst sequence...");
                             Res = spis_EndOfSequence();
                             if (Res != 0) { printf("failed!\n"); }
                             else { printf("done\n"); }*/
                          

                          @

                          These parts might be the thing you are missing to get your data right. They seem to initialize something for the following calls and then put things back to normal.

                          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

                          • Login

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