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. As dynamic libraries to use class variables?
Forum Updated to NodeBB v4.3 + New Features

As dynamic libraries to use class variables?

Scheduled Pinned Locked Moved Solved General and Desktop
50 Posts 4 Posters 13.0k Views 3 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.
  • M Offline
    M Offline
    Mikee
    wrote on last edited by
    #7

    I use class

    #ifndef MAINWINDOW_H
    #define MAINWINDOW_H
    
    #include <QMainWindow>
    #include "qcustomplot.h"
    #include <QFile>  
    #include <QDebug>
    #include <QByteArray> 
    #include <QString> 
    #include <QVector>
    #include <QTextStream>
    #include <QStringList>
    #include <iostream>
    #include <QtConcurrent/QtConcurrent>
    #include <QMutex>
    
    
    namespace Ui {
    class MainWindow;
    }
    
    class MainWindow : public QMainWindow
    {
        Q_OBJECT
    
    public:
        explicit MainWindow(QWidget *parent = 0);
        ~MainWindow();
      long long NBar;
    

    When i do

    #include <C:\\Qt\project\\MyCandleSrick\\mainwindow.h>
    

    Appeared error: no files

    #include <QMainWindow>
    #include "qcustomplot.h"
    #include <QFile>  
    #include <QDebug> 
    #include <QByteArray> 
    #include <QString> 
    #include <QVector>
    #include <QTextStream>
    #include <QStringList>
    #include <iostream>
    #include <QtConcurrent/QtConcurrent>
    #include <QMutex>
    
    mrjjM 1 Reply Last reply
    0
    • M Mikee

      I use class

      #ifndef MAINWINDOW_H
      #define MAINWINDOW_H
      
      #include <QMainWindow>
      #include "qcustomplot.h"
      #include <QFile>  
      #include <QDebug>
      #include <QByteArray> 
      #include <QString> 
      #include <QVector>
      #include <QTextStream>
      #include <QStringList>
      #include <iostream>
      #include <QtConcurrent/QtConcurrent>
      #include <QMutex>
      
      
      namespace Ui {
      class MainWindow;
      }
      
      class MainWindow : public QMainWindow
      {
          Q_OBJECT
      
      public:
          explicit MainWindow(QWidget *parent = 0);
          ~MainWindow();
        long long NBar;
      

      When i do

      #include <C:\\Qt\project\\MyCandleSrick\\mainwindow.h>
      

      Appeared error: no files

      #include <QMainWindow>
      #include "qcustomplot.h"
      #include <QFile>  
      #include <QDebug> 
      #include <QByteArray> 
      #include <QString> 
      #include <QVector>
      #include <QTextStream>
      #include <QStringList>
      #include <iostream>
      #include <QtConcurrent/QtConcurrent>
      #include <QMutex>
      
      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #8

      @Mikee
      I dont know what "error: no files" is or means or what happens.
      where do you do

      #include <C:\\Qt\project\\MyCandleSrick\\mainwindow.h> ?
      also should be
      #include "C:\\Qt\project\\MyCandleSrick\\mainwindow.h"
      
      1 Reply Last reply
      0
      • M Offline
        M Offline
        Mikee
        wrote on last edited by
        #9

        In the library :

        #include "C:\\Qt\project\\MyCandleSrick\\mainwindow.h"
        

        error:
        C:\Qt\project\MyCandleSrick\mainwindow.h:4: error: QMainWindow: No such file or directory

        mrjjM 1 Reply Last reply
        0
        • M Mikee

          In the library :

          #include "C:\\Qt\project\\MyCandleSrick\\mainwindow.h"
          

          error:
          C:\Qt\project\MyCandleSrick\mainwindow.h:4: error: QMainWindow: No such file or directory

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #10

          @Mikee
          Well what is on line 4 in mainwindow.h ?
          It says it cant find what ever you include there.

          1 Reply Last reply
          0
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #11

            Hi
            You should use
            http://doc.qt.io/qt-5/qmake-variable-reference.html#includepath

            instead of linking to the file with full path

            1 Reply Last reply
            0
            • M Offline
              M Offline
              Mikee
              wrote on last edited by
              #12

              4: #include <QMainWindow>
              I have no patch, I have a dynamic library.

              1 Reply Last reply
              0
              • M Offline
                M Offline
                Mikee
                wrote on last edited by
                #13

                May be need use http://doc.qt.io/Qt-5/qlocalsocket.html ?

                mrjjM 1 Reply Last reply
                0
                • M Mikee

                  May be need use http://doc.qt.io/Qt-5/qlocalsocket.html ?

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #14

                  @Mikee
                  not a patch, a path
                  you include with
                  #include "C:\Qt\project\MyCandleSrick\mainwindow.h"

                  then in THAT mainwindow.h, if it tries to include something else
                  it will look in the folder with the .pro file for the current project and
                  will know nothing about MyCandleSrick folder.

                  So im saying:
                  it will not work good for you to include using full paths, it will not be able to find other files.
                  and hence you should tell it with
                  http://doc.qt.io/qt-5/qmake-variable-reference.html#includepath
                  where ALSO to look for other files.
                  Else it will miss what ever mainwindow.h also includes.

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    Mikee
                    wrote on last edited by Mikee
                    #15

                    It is my *.pro file. What to do next?

                    QT       -= gui
                    
                    TARGET = StrategyCod
                    TEMPLATE = lib
                    
                    DEFINES += STRATEGYCOD_LIBRARY
                    DEFINES += QT_DEPRECATED_WARNINGS
                    
                    SOURCES += \
                            strategycod.cpp
                    
                    HEADERS += \
                            strategycod.h \
                            strategycod_global.h 
                    
                    unix {
                        target.path = /usr/lib
                        INSTALLS += target
                    }
                    
                    INCLUDEPATH = c : / mainwindow.h/include
                    
                    mrjjM 1 Reply Last reply
                    0
                    • M Mikee

                      It is my *.pro file. What to do next?

                      QT       -= gui
                      
                      TARGET = StrategyCod
                      TEMPLATE = lib
                      
                      DEFINES += STRATEGYCOD_LIBRARY
                      DEFINES += QT_DEPRECATED_WARNINGS
                      
                      SOURCES += \
                              strategycod.cpp
                      
                      HEADERS += \
                              strategycod.h \
                              strategycod_global.h 
                      
                      unix {
                          target.path = /usr/lib
                          INSTALLS += target
                      }
                      
                      INCLUDEPATH = c : / mainwindow.h/include
                      
                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #16

                      @Mikee said in As dynamic libraries to use class variables?:

                      INCLUDEPATH = c : / mainwindow.h/include

                      That is complete wrong syntax ?

                      INCLUDEPATH = "C:/Qt/project/MyCandleSrick"

                      if that is the folder where it should look for the other files.

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        Mikee
                        wrote on last edited by
                        #17

                        I replaced. What to do next?

                        QT       -= gui
                        
                        TARGET = StrategyCod
                        TEMPLATE = lib
                        
                        DEFINES += STRATEGYCOD_LIBRARY
                        DEFINES += QT_DEPRECATED_WARNINGS
                        SOURCES += \
                                strategycod.cpp
                        
                        HEADERS += \
                                strategycod.h \
                                strategycod_global.h 
                        
                        unix {
                            target.path = /usr/lib
                            INSTALLS += target
                        }
                        
                        #INCLUDEPATH = C: / Qt / project / MyCandleSrick/include
                        INCLUDEPATH = "C: / Qt / project / MyCandleSrick"
                        
                        mrjjM 1 Reply Last reply
                        0
                        • M Mikee

                          I replaced. What to do next?

                          QT       -= gui
                          
                          TARGET = StrategyCod
                          TEMPLATE = lib
                          
                          DEFINES += STRATEGYCOD_LIBRARY
                          DEFINES += QT_DEPRECATED_WARNINGS
                          SOURCES += \
                                  strategycod.cpp
                          
                          HEADERS += \
                                  strategycod.h \
                                  strategycod_global.h 
                          
                          unix {
                              target.path = /usr/lib
                              INSTALLS += target
                          }
                          
                          #INCLUDEPATH = C: / Qt / project / MyCandleSrick/include
                          INCLUDEPATH = "C: / Qt / project / MyCandleSrick"
                          
                          mrjjM Offline
                          mrjjM Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on last edited by
                          #18

                          @Mikee said in As dynamic libraries to use class variables?:

                          INCLUDEPATH = "C: / Qt / project / MyCandleSrick"

                          Why the spaces ?
                          Seems not correct.

                          -What to do next?
                          Depends on what you are trying ?
                          If you can now build your library and get a DLL
                          then you should load that library in your main app and
                          try to call function StrategyCod2 with your data.

                          https://wiki.qt.io/How_to_create_a_library_with_Qt_and_use_it_in_an_application
                          See section "Loading the library using QLibrary"

                          Since you are not exporting void StrategyCod2()
                          you need to resolve it to call it.
                          http://doc.qt.io/qt-5/qlibrary.html#resolve

                          1 Reply Last reply
                          0
                          • M Offline
                            M Offline
                            Mikee
                            wrote on last edited by
                            #19

                            This is my library:
                            StrategyCod.pro:

                            QT       -= gui
                            
                            TARGET = StrategyCod
                            TEMPLATE = lib
                            
                            DEFINES += STRATEGYCOD_LIBRARY
                            
                            # The following define makes your compiler emit warnings if you use
                            # any feature of Qt which has been marked as deprecated (the exact warnings
                            # depend on your compiler). Please consult the documentation of the
                            # deprecated API in order to know how to port your code away from it.
                            DEFINES += QT_DEPRECATED_WARNINGS
                            
                            # You can also make your code fail to compile if you use deprecated APIs.
                            # In order to do so, uncomment the following line.
                            # You can also select to disable deprecated APIs only up to a certain version of Qt.
                            #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
                            
                            SOURCES += \
                                    strategycod.cpp
                            
                            HEADERS += \
                                    strategycod.h \
                                    strategycod_global.h 
                            
                            unix {
                                target.path = /usr/lib
                                INSTALLS += target
                            }
                            
                            #INCLUDEPATH = C: / Qt / project / MyCandleSrick/include
                            INCLUDEPATH = "C:/Qt/project/MyCandleSrick"
                            

                            strategycod.h:

                            #ifndef STRATEGYCOD_H
                            #define STRATEGYCOD_H
                            
                            #include "strategycod_global.h"
                            
                            
                            extern "C" {STRATEGYCODSHARED_EXPORT void StrategyCod();}
                            
                            class STRATEGYCODSHARED_EXPORT StrategyCod
                            {
                            
                            //public:
                               // StrategyCod1();
                            };
                            
                            #endif // STRATEGYCOD_H
                            
                            

                            strategycod_global.h:

                            #ifndef STRATEGYCOD_GLOBAL_H
                            #define STRATEGYCOD_GLOBAL_H
                            
                            #include <QtCore/qglobal.h>
                            
                            #if defined(STRATEGYCOD_LIBRARY)
                            #  define STRATEGYCODSHARED_EXPORT Q_DECL_EXPORT
                            #else
                            #  define STRATEGYCODSHARED_EXPORT Q_DECL_IMPORT
                            #endif
                            
                            #endif // STRATEGYCOD_GLOBAL_H
                            

                            strategycod.cpp:

                            #include "strategycod.h"
                            #include <QDebug>
                            //#include "C:\\Qt\project\\MyCandleSrick\\mainwindow.h"
                            //#include <mainwindow>
                            //StrategyCod::StrategyCod1(){qDebug()<<"Library work1";}
                            
                            
                            
                            void StrategyCod()
                            {
                                //MainWindow w;
                                qDebug()<<"Library work2";//<<w.NBar;
                            }
                            

                            This is my app
                            main.cpp

                            #include "mainwindow.h"
                            #include <QApplication>
                            #include <cstdlib>
                            #include <QMessageBox>
                            #include <QtConcurrent/QtConcurrent>
                            #include <QMutex>
                            int main(int argc, char *argv[])
                            {
                                QApplication a(argc, argv);
                                MainWindow w;    
                                QLibrary MyLib("C:\\Qt\\project\\build-StrategyCod-Desktop_Qt_5_9_2_MinGW_32bit-Debug\\debug\\StrategyCod"); 
                                MyLib.load();
                                typedef void (*MyPrototype)();
                                MyPrototype StrategyCod = (MyPrototype) MyLib.resolve("StrategyCod");
                                StrategyCod();  
                                MyLib.unload();
                                w.show();
                                return a.exec();
                            }
                            

                            In the MainWindow class is written needed variables.
                            But I can not create an object of MainWindow class in the library and can't use its variables.

                            mrjjM 1 Reply Last reply
                            0
                            • M Mikee

                              This is my library:
                              StrategyCod.pro:

                              QT       -= gui
                              
                              TARGET = StrategyCod
                              TEMPLATE = lib
                              
                              DEFINES += STRATEGYCOD_LIBRARY
                              
                              # The following define makes your compiler emit warnings if you use
                              # any feature of Qt which has been marked as deprecated (the exact warnings
                              # depend on your compiler). Please consult the documentation of the
                              # deprecated API in order to know how to port your code away from it.
                              DEFINES += QT_DEPRECATED_WARNINGS
                              
                              # You can also make your code fail to compile if you use deprecated APIs.
                              # In order to do so, uncomment the following line.
                              # You can also select to disable deprecated APIs only up to a certain version of Qt.
                              #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
                              
                              SOURCES += \
                                      strategycod.cpp
                              
                              HEADERS += \
                                      strategycod.h \
                                      strategycod_global.h 
                              
                              unix {
                                  target.path = /usr/lib
                                  INSTALLS += target
                              }
                              
                              #INCLUDEPATH = C: / Qt / project / MyCandleSrick/include
                              INCLUDEPATH = "C:/Qt/project/MyCandleSrick"
                              

                              strategycod.h:

                              #ifndef STRATEGYCOD_H
                              #define STRATEGYCOD_H
                              
                              #include "strategycod_global.h"
                              
                              
                              extern "C" {STRATEGYCODSHARED_EXPORT void StrategyCod();}
                              
                              class STRATEGYCODSHARED_EXPORT StrategyCod
                              {
                              
                              //public:
                                 // StrategyCod1();
                              };
                              
                              #endif // STRATEGYCOD_H
                              
                              

                              strategycod_global.h:

                              #ifndef STRATEGYCOD_GLOBAL_H
                              #define STRATEGYCOD_GLOBAL_H
                              
                              #include <QtCore/qglobal.h>
                              
                              #if defined(STRATEGYCOD_LIBRARY)
                              #  define STRATEGYCODSHARED_EXPORT Q_DECL_EXPORT
                              #else
                              #  define STRATEGYCODSHARED_EXPORT Q_DECL_IMPORT
                              #endif
                              
                              #endif // STRATEGYCOD_GLOBAL_H
                              

                              strategycod.cpp:

                              #include "strategycod.h"
                              #include <QDebug>
                              //#include "C:\\Qt\project\\MyCandleSrick\\mainwindow.h"
                              //#include <mainwindow>
                              //StrategyCod::StrategyCod1(){qDebug()<<"Library work1";}
                              
                              
                              
                              void StrategyCod()
                              {
                                  //MainWindow w;
                                  qDebug()<<"Library work2";//<<w.NBar;
                              }
                              

                              This is my app
                              main.cpp

                              #include "mainwindow.h"
                              #include <QApplication>
                              #include <cstdlib>
                              #include <QMessageBox>
                              #include <QtConcurrent/QtConcurrent>
                              #include <QMutex>
                              int main(int argc, char *argv[])
                              {
                                  QApplication a(argc, argv);
                                  MainWindow w;    
                                  QLibrary MyLib("C:\\Qt\\project\\build-StrategyCod-Desktop_Qt_5_9_2_MinGW_32bit-Debug\\debug\\StrategyCod"); 
                                  MyLib.load();
                                  typedef void (*MyPrototype)();
                                  MyPrototype StrategyCod = (MyPrototype) MyLib.resolve("StrategyCod");
                                  StrategyCod();  
                                  MyLib.unload();
                                  w.show();
                                  return a.exec();
                              }
                              

                              In the MainWindow class is written needed variables.
                              But I can not create an object of MainWindow class in the library and can't use its variables.

                              mrjjM Offline
                              mrjjM Offline
                              mrjj
                              Lifetime Qt Champion
                              wrote on last edited by
                              #20

                              Hi
                              Ok, and you can call the void StrategyCod() function ? ( that works ?)
                              If yes, you can now
                              make it into

                              void StrategyCod(MainWinow *main) ( it should know the type since u include its .h file)
                              extern "C" {STRATEGYCODSHARED_EXPORT void StrategyCod(MainWinow *main);}

                              and from main call it with
                              typedef void (*MyPrototype)((MainWinow *);
                              MyPrototype StrategyCod = (MyPrototype) MyLib.resolve("StrategyCod");
                              StrategyCod(&w); // give it the real MainWindow

                              There is no reason to try to create a new MainWindow inside the StrategyCod() function as
                              that would be ANOTHER mainwindow than the running one and not have the right data.

                              You should give it as parameter.

                              Using mainwindow seems silly, a Data class would make more sense but can work.
                              But you should NOT call any functions inside mainwindow from library as there is no event loop running and
                              it will not work. But you should be able to use public member variables.

                              1 Reply Last reply
                              0
                              • M Offline
                                M Offline
                                Mikee
                                wrote on last edited by
                                #21

                                I can call the void StrategyCod() .
                                I did:
                                strategycod.h:

                                #ifndef STRATEGYCOD_H
                                #define STRATEGYCOD_H
                                
                                #include "strategycod_global.h"
                                
                                
                                extern "C" {STRATEGYCODSHARED_EXPORT void StrategyCod(MainWinow * main);}
                                
                                class STRATEGYCODSHARED_EXPORT StrategyCod
                                {
                                
                                //public:
                                   // StrategyCod1();
                                };
                                
                                #endif // STRATEGYCOD_H
                                

                                strategycod.cpp:

                                #include "strategycod.h"
                                #include <QDebug>
                                //#include "C:\\Qt\project\\MyCandleSrick\\mainwindow.h"
                                //#include <mainwindow>
                                //StrategyCod::StrategyCod1(){qDebug()<<"Library work1";}
                                
                                
                                
                                void StrategyCod(MainWinow * main)
                                {
                                    //MainWindow w;
                                    qDebug()<<"Library work2";//<<w.NBar;
                                }
                                

                                6 errors:
                                C:\Qt\project\StrategyCod\strategycod.h:7: error: variable or field 'StrategyCod' declared void
                                extern "C" {STRATEGYCODSHARED_EXPORT void StrategyCod(MainWinow * main);}
                                ^
                                C:\Qt\project\StrategyCod\strategycod.h:7: error: 'MainWinow' was not declared in this scope
                                C:\Qt\project\StrategyCod\strategycod.h:7: error: 'main' was not declared in this scope
                                extern "C" {STRATEGYCODSHARED_EXPORT void StrategyCod(MainWinow * main);}
                                ^
                                C:\Qt\project\StrategyCod\strategycod.cpp:9: оerror: variable or field 'StrategyCod' declared void
                                void StrategyCod(MainWinow * main)
                                ^
                                C:\Qt\project\StrategyCod\strategycod.cpp:9: error: 'MainWinow' was not declared in this scope
                                C:\Qt\project\StrategyCod\strategycod.cpp:9: error: 'main' was not declared in this scope
                                void StrategyCod(MainWinow * main)
                                ^

                                mrjjM 1 Reply Last reply
                                0
                                • M Mikee

                                  I can call the void StrategyCod() .
                                  I did:
                                  strategycod.h:

                                  #ifndef STRATEGYCOD_H
                                  #define STRATEGYCOD_H
                                  
                                  #include "strategycod_global.h"
                                  
                                  
                                  extern "C" {STRATEGYCODSHARED_EXPORT void StrategyCod(MainWinow * main);}
                                  
                                  class STRATEGYCODSHARED_EXPORT StrategyCod
                                  {
                                  
                                  //public:
                                     // StrategyCod1();
                                  };
                                  
                                  #endif // STRATEGYCOD_H
                                  

                                  strategycod.cpp:

                                  #include "strategycod.h"
                                  #include <QDebug>
                                  //#include "C:\\Qt\project\\MyCandleSrick\\mainwindow.h"
                                  //#include <mainwindow>
                                  //StrategyCod::StrategyCod1(){qDebug()<<"Library work1";}
                                  
                                  
                                  
                                  void StrategyCod(MainWinow * main)
                                  {
                                      //MainWindow w;
                                      qDebug()<<"Library work2";//<<w.NBar;
                                  }
                                  

                                  6 errors:
                                  C:\Qt\project\StrategyCod\strategycod.h:7: error: variable or field 'StrategyCod' declared void
                                  extern "C" {STRATEGYCODSHARED_EXPORT void StrategyCod(MainWinow * main);}
                                  ^
                                  C:\Qt\project\StrategyCod\strategycod.h:7: error: 'MainWinow' was not declared in this scope
                                  C:\Qt\project\StrategyCod\strategycod.h:7: error: 'main' was not declared in this scope
                                  extern "C" {STRATEGYCODSHARED_EXPORT void StrategyCod(MainWinow * main);}
                                  ^
                                  C:\Qt\project\StrategyCod\strategycod.cpp:9: оerror: variable or field 'StrategyCod' declared void
                                  void StrategyCod(MainWinow * main)
                                  ^
                                  C:\Qt\project\StrategyCod\strategycod.cpp:9: error: 'MainWinow' was not declared in this scope
                                  C:\Qt\project\StrategyCod\strategycod.cpp:9: error: 'main' was not declared in this scope
                                  void StrategyCod(MainWinow * main)
                                  ^

                                  mrjjM Offline
                                  mrjjM Offline
                                  mrjj
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #22

                                  Hi
                                  You must include mainwindw.h so it knows type

                                  trategycod.cpp:
                                  #include "mainwindow.h" // should know where to find it due to the INCLUDEPATH in .pro file

                                  1 Reply Last reply
                                  1
                                  • M Offline
                                    M Offline
                                    Mikee
                                    wrote on last edited by Mikee
                                    #23

                                    When i do this same error appers:
                                    C:\Qt\project\MyCandleSrick\mainwindow.h:4: error: QMainWindow: No such file or directory

                                    In the file C:/Qt/project/MyCandleSrick/mainwindow.h:
                                    4:#include <QMainWindow>

                                    mrjjM 1 Reply Last reply
                                    0
                                    • M Mikee

                                      When i do this same error appers:
                                      C:\Qt\project\MyCandleSrick\mainwindow.h:4: error: QMainWindow: No such file or directory

                                      In the file C:/Qt/project/MyCandleSrick/mainwindow.h:
                                      4:#include <QMainWindow>

                                      mrjjM Offline
                                      mrjjM Offline
                                      mrjj
                                      Lifetime Qt Champion
                                      wrote on last edited by mrjj
                                      #24

                                      @Mikee
                                      Well you library is with

                                      QT -= gui

                                      so it dont know QMainwindow type ( or any Qt widget type)

                                      1 Reply Last reply
                                      1
                                      • M Offline
                                        M Offline
                                        Mikee
                                        wrote on last edited by
                                        #25

                                        I fixed strategycod.pro:

                                        QT       += core gui
                                        
                                        TARGET = StrategyCod
                                        TEMPLATE = lib
                                        
                                        DEFINES += STRATEGYCOD_LIBRARY
                                        DEFINES += QT_DEPRECATED_WARNINGS
                                        SOURCES += \
                                                strategycod.cpp
                                        
                                        HEADERS += \
                                                strategycod.h \
                                                strategycod_global.h 
                                        
                                        unix {
                                            target.path = /usr/lib
                                            INSTALLS += target
                                        }
                                        INCLUDEPATH = "C:/Qt/project/MyCandleSrick"
                                        

                                        But the error is the same.

                                        1 Reply Last reply
                                        0
                                        • M Offline
                                          M Offline
                                          Mikee
                                          wrote on last edited by
                                          #26

                                          I done this in strategycod.pro

                                          INCLUDEPATH = "C:/Qt/project/MyCandleSrick"  "C:/Qt/Qt5.9.2/5.9.2/Src/qtbase/include/QtWidgets"
                                          

                                          Now it included <QMainWindow>. But it isnt working now

                                          extern "C" {STRATEGYCODSHARED_EXPORT void StrategyCod(MainWinow * main);}
                                          

                                          and

                                          void StrategyCod(MainWinow * main)
                                          

                                          errors:
                                          C:\Qt\project\StrategyCod\strategycod.h:7: error: variable or field 'StrategyCod' declared void
                                          extern "C" {STRATEGYCODSHARED_EXPORT void StrategyCod(MainWinow * main);}
                                          ^
                                          C:\Qt\project\StrategyCod\strategycod.h:7: error: 'MainWinow' was not declared in this scope
                                          C:\Qt\project\StrategyCod\strategycod.h:7: error: 'main' was not declared in this scope
                                          extern "C" {STRATEGYCODSHARED_EXPORT void StrategyCod(MainWinow * main);}
                                          ^
                                          C:\Qt\project\StrategyCod\strategycod.cpp:9: оerror: variable or field 'StrategyCod' declared void
                                          void StrategyCod(MainWinow * main)
                                          ^
                                          C:\Qt\project\StrategyCod\strategycod.cpp:9: error: 'MainWinow' was not declared in this scope
                                          C:\Qt\project\StrategyCod\strategycod.cpp:9: error: 'main' was not declared in this scope
                                          void StrategyCod(MainWinow * main)

                                          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