Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How do i integrate my embedded C source codes (for my embedded linux board) with Qt GUI together?
Forum Updated to NodeBB v4.3 + New Features

How do i integrate my embedded C source codes (for my embedded linux board) with Qt GUI together?

Scheduled Pinned Locked Moved Solved Mobile and Embedded
33 Posts 4 Posters 9.5k Views 2 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
    mrjj
    Lifetime Qt Champion
    wrote on 26 Sept 2016, 08:56 last edited by mrjj
    #15

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    MainWindow w;
    w.show();

    int SAMPLE_VDEC_VdhH264(); <<<< why here??? that is forward in main. not what i ment.

    return a.exec();
    }

    Did you make a .h file with ?
    int SAMPLE_VDEC_VdhH264();

    else
    i mean like

    int SAMPLE_VDEC_VdhH264();

    void MainWindow::on_pushButton_clicked()
    {

    SAMPLE_VDEC_VdhH264();

    }

    E 1 Reply Last reply 26 Sept 2016, 09:42
    0
    • M mrjj
      26 Sept 2016, 08:56

      int main(int argc, char *argv[])
      {
      QApplication a(argc, argv);
      MainWindow w;
      w.show();

      int SAMPLE_VDEC_VdhH264(); <<<< why here??? that is forward in main. not what i ment.

      return a.exec();
      }

      Did you make a .h file with ?
      int SAMPLE_VDEC_VdhH264();

      else
      i mean like

      int SAMPLE_VDEC_VdhH264();

      void MainWindow::on_pushButton_clicked()
      {

      SAMPLE_VDEC_VdhH264();

      }

      E Offline
      E Offline
      embdev
      wrote on 26 Sept 2016, 09:42 last edited by embdev
      #16

      @mrjj my apologies, I've read it otherwise. However, it seems that the compiler can't find my function definition. It's a separate source code which I've added into the project entitled "sample_vdec.c". The function definition in this source code is:

      HI_S32 SAMPLE_VDEC_VdhH264(HI_VOID)
      {
      ....................
      }

      I've amended to the following:

      in mainwindow.cpp:

      #include "mainwindow.h"
      #include "ui_mainwindow.h"
      #include "hi3536mainfx.h"

      MainWindow::MainWindow(QWidget *parent) :
      QMainWindow(parent),
      ui(new Ui::MainWindow)
      {
      ui->setupUi(this);
      }

      MainWindow::~MainWindow()
      {
      delete ui;
      }

      HI_U32 SAMPLE_VDEC_VdhH264();

      void MainWindow::on_pushButton_clicked()
      {

      SAMPLE_VDEC_VdhH264();

      }

      in main.cpp

      #include "mainwindow.h"
      #include <QApplication>

      int main(int argc, char *argv[])
      {
      QApplication a(argc, argv);
      MainWindow w;
      w.show();

      return a.exec();
      

      }

      in header

      #ifndef HI3536MAINFX_H
      #define HI3536MAINFX_H
      #include <hi_type.h>
      #include <hi_comm_vb.h>

      typedef struct hiVDEC_USERPIC_S
      {
      HI_U32 u32PicWidth;
      HI_U32 u32PicHeigth;
      VB_POOL u32PoolId;
      VB_BLK u32BlkHandle;
      HI_U32 u32PhyAddr;
      HI_VOID *pVirAddr;
      }VDEC_USERPIC_S;

      HI_U32 SAMPLE_VDEC_VdhH264();

      #endif // HI3536MAINFX_H

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mrjj
        Lifetime Qt Champion
        wrote on 26 Sept 2016, 10:00 last edited by
        #17

        since you have a
        HI3536MAINFX_H
        with
        HI_U32 SAMPLE_VDEC_VdhH264();

        you dont need it over
        void MainWindow::on_pushButton_clicked()
        also.

        so compiles now?

        E 1 Reply Last reply 27 Sept 2016, 01:46
        0
        • M mrjj
          26 Sept 2016, 10:00

          since you have a
          HI3536MAINFX_H
          with
          HI_U32 SAMPLE_VDEC_VdhH264();

          you dont need it over
          void MainWindow::on_pushButton_clicked()
          also.

          so compiles now?

          E Offline
          E Offline
          embdev
          wrote on 27 Sept 2016, 01:46 last edited by embdev
          #18

          @mrjj discovered some error in datatype in my code but rectified it but still unable to compile. The error says undefined reference to SAMPLE_VDEC_VhdH264(); and ld returned 1 exit status.
          When I highlighted VDEC_SAMPLEVhdH264(); in main.cpp and hit [F2] cursor recursively, it brings me to the sample source code where this function is defined but doesn't brings me to the header where I declared this function.

          ** in main.cpp **

          #include "mainwindow.h"
          #include "ui_mainwindow.h"
          #include "hi3536mainfx.h"
          
          MainWindow::MainWindow(QWidget *parent) :
              QMainWindow(parent),
              ui(new Ui::MainWindow)
          {
              ui->setupUi(this);
          }
          
          MainWindow::~MainWindow()
          {
              delete ui;
          }
          
          
          void MainWindow::on_pushButton_clicked()
          {
          
             SAMPLE_VDEC_VdhH264();
          
          }
          

          ** in sample source code where SAMPLE_VDEC_VhdH264() is defined: **

          HI_S32 SAMPLE_VDEC_VdhH264(HI_VOID)
          {
              VB_CONF_S stVbConf, stModVbConf;
              HI_S32 i, s32Ret = HI_SUCCESS;
              VDEC_CHN_ATTR_S stVdecChnAttr[VDEC_MAX_CHN_NUM];
              VdecThreadParam stVdecSend[VDEC_MAX_CHN_NUM];
              VPSS_GRP_ATTR_S stVpssGrpAttr[VDEC_MAX_CHN_NUM];
           ..... ..... .....
          }
          

          ** in my header file **

          #ifndef HI3536MAINFX_H
          #define HI3536MAINFX_H
          #include "hi_comm_vb.h"
          #include "hi_type.h"
          
          typedef struct hiVDEC_USERPIC_S
          {
              HI_U32   u32PicWidth;
              HI_U32   u32PicHeigth;
              VB_POOL  u32PoolId;
              VB_BLK   u32BlkHandle;
              HI_U32   u32PhyAddr;
              HI_VOID  *pVirAddr;
          }VDEC_USERPIC_S;
          
          HI_S32 SAMPLE_VDEC_VdhH264(HI_VOID);
          
          #endif // HI3536MAINFX_H
          
          J 1 Reply Last reply 27 Sept 2016, 04:49
          0
          • E embdev
            27 Sept 2016, 01:46

            @mrjj discovered some error in datatype in my code but rectified it but still unable to compile. The error says undefined reference to SAMPLE_VDEC_VhdH264(); and ld returned 1 exit status.
            When I highlighted VDEC_SAMPLEVhdH264(); in main.cpp and hit [F2] cursor recursively, it brings me to the sample source code where this function is defined but doesn't brings me to the header where I declared this function.

            ** in main.cpp **

            #include "mainwindow.h"
            #include "ui_mainwindow.h"
            #include "hi3536mainfx.h"
            
            MainWindow::MainWindow(QWidget *parent) :
                QMainWindow(parent),
                ui(new Ui::MainWindow)
            {
                ui->setupUi(this);
            }
            
            MainWindow::~MainWindow()
            {
                delete ui;
            }
            
            
            void MainWindow::on_pushButton_clicked()
            {
            
               SAMPLE_VDEC_VdhH264();
            
            }
            

            ** in sample source code where SAMPLE_VDEC_VhdH264() is defined: **

            HI_S32 SAMPLE_VDEC_VdhH264(HI_VOID)
            {
                VB_CONF_S stVbConf, stModVbConf;
                HI_S32 i, s32Ret = HI_SUCCESS;
                VDEC_CHN_ATTR_S stVdecChnAttr[VDEC_MAX_CHN_NUM];
                VdecThreadParam stVdecSend[VDEC_MAX_CHN_NUM];
                VPSS_GRP_ATTR_S stVpssGrpAttr[VDEC_MAX_CHN_NUM];
             ..... ..... .....
            }
            

            ** in my header file **

            #ifndef HI3536MAINFX_H
            #define HI3536MAINFX_H
            #include "hi_comm_vb.h"
            #include "hi_type.h"
            
            typedef struct hiVDEC_USERPIC_S
            {
                HI_U32   u32PicWidth;
                HI_U32   u32PicHeigth;
                VB_POOL  u32PoolId;
                VB_BLK   u32BlkHandle;
                HI_U32   u32PhyAddr;
                HI_VOID  *pVirAddr;
            }VDEC_USERPIC_S;
            
            HI_S32 SAMPLE_VDEC_VdhH264(HI_VOID);
            
            #endif // HI3536MAINFX_H
            
            J Offline
            J Offline
            jsulm
            Lifetime Qt Champion
            wrote on 27 Sept 2016, 04:49 last edited by
            #19

            @embdev said in How do i integrate my embedded C source codes (for my embedded linux board) with Qt GUI together?:

            in sample source code where SAMPLE_VDEC_VhdH264() is defined:

            Is the source file containing SAMPLE_VDEC_VhdH264() part of your project and is it built?

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            E 1 Reply Last reply 27 Sept 2016, 06:46
            0
            • J jsulm
              27 Sept 2016, 04:49

              @embdev said in How do i integrate my embedded C source codes (for my embedded linux board) with Qt GUI together?:

              in sample source code where SAMPLE_VDEC_VhdH264() is defined:

              Is the source file containing SAMPLE_VDEC_VhdH264() part of your project and is it built?

              E Offline
              E Offline
              embdev
              wrote on 27 Sept 2016, 06:46 last edited by
              #20

              @jsulm yes it is, the source file containing the function definition SAMPLE_VDEC_VhdH264() is added physically into the project file.

              J 1 Reply Last reply 27 Sept 2016, 06:56
              0
              • E embdev
                27 Sept 2016, 06:46

                @jsulm yes it is, the source file containing the function definition SAMPLE_VDEC_VhdH264() is added physically into the project file.

                J Offline
                J Offline
                jsulm
                Lifetime Qt Champion
                wrote on 27 Sept 2016, 06:56 last edited by jsulm
                #21

                @embdev You should check the complete "Compile Output" to see whether that file was really built and linked to your executable.
                Don't forget that you should always execute qmake again (and do a rebuild) if you change the .pro file!

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                E 1 Reply Last reply 27 Sept 2016, 07:46
                0
                • J jsulm
                  27 Sept 2016, 06:56

                  @embdev You should check the complete "Compile Output" to see whether that file was really built and linked to your executable.
                  Don't forget that you should always execute qmake again (and do a rebuild) if you change the .pro file!

                  E Offline
                  E Offline
                  embdev
                  wrote on 27 Sept 2016, 07:46 last edited by
                  #22

                  @jsulm I did a clean, followed by build again in Qt Creator IDE environment but still receiving the error:
                  In the .pro file, my source file containing the SAMPLE_VDEC_VhdH264() is also included under SOURCES +=

                  This is an output from the compile tab:

                  5:39:36: Running steps for project vdec_test...
                  15:39:36: Configuration unchanged, skipping qmake step.
                  15:39:36: Starting: "/usr/bin/make" 
                  arm-hisiv400-linux-g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../../v1_QtEmbedded-4.8.6/mkspecs/qws/linux-hisiv400-arm-g++ -I../vdec_test -I../../v1_QtEmbedded-4.8.6/include/QtCore -I../../v1_QtEmbedded-4.8.6/include/QtNetwork -I../../v1_QtEmbedded-4.8.6/include/QtGui -I../../v1_QtEmbedded-4.8.6/include -I../../mpp_single/sample/common -I../../mpp_single/include -I../../mpp_single/extdrv/tlv320aic31 -I../../v1_QtEmbedded-4.8.6/examples/multimedia/videographicsitem -I../../mpp_single/lib -I../../mpp_single/include -I../../mpp_single/include -I../../mpp_single/include -I../../mpp_single/include -I../../mpp_single/include -I../../mpp_single/include -I. -I. -I../vdec_test -I. -o mainwindow.o ../vdec_test/mainwindow.cpp
                  arm-hisiv400-linux-g++ -Wl,-O1 -Wl,-rpath,/home/aa/Hi3536_SDK_V2.0.4.0/v1_QtEmbedded-4.8.6/lib -o vdec_test main.o mainwindow.o sample_comm_audio.o sample_comm_ivs.o sample_comm_sys.o sample_comm_vda.o sample_comm_vdec.o sample_comm_venc.o sample_comm_vi.o sample_comm_vo.o sample_comm_vpss.o sample_vdec.o moc_mainwindow.o    -L/home/aa/Hi3536_SDK_V2.0.4.0/v1_QtEmbedded-4.8.6/lib -L/home/aa/Hi3536_SDK_V2.0.4.0/Working\ folder/vdec_test/../../mpp_single/lib/ -ldnvqe -lhdmi -lmpi -ljpeg -lupvqe -lVoiceEngine -lQtGui -L/home/aa/Hi3536_SDK_V2.0.4.0/v1_QtEmbedded-4.8.6/lib -lQtNetwork -lQtCore -lm -ldl -lrt -lpthread 
                  mainwindow.o: In function `MainWindow::on_pushButton_clicked()':
                  mainwindow.cpp:(.text+0xbc): undefined reference to `SAMPLE_VDEC_VdhH264()'
                  mainwindow.o: In function `MainWindow::on_pushButton_2_clicked()':
                  mainwindow.cpp:(.text+0xc0): undefined reference to `SAMPLE_VDEC_VdhH265()'
                  collect2: error: ld returned 1 exit status
                  Makefile:125: recipe for target 'vdec_test' failed
                  make: *** [vdec_test] Error 1
                  15:39:37: The process "/usr/bin/make" exited with code 2.
                  Error while building/deploying project vdec_test (kit: HI3536 Qt4.8)
                  When executing step "Make"
                  15:39:37: Elapsed time: 00:01.
                  
                  J 1 Reply Last reply 27 Sept 2016, 07:58
                  0
                  • E embdev
                    27 Sept 2016, 07:46

                    @jsulm I did a clean, followed by build again in Qt Creator IDE environment but still receiving the error:
                    In the .pro file, my source file containing the SAMPLE_VDEC_VhdH264() is also included under SOURCES +=

                    This is an output from the compile tab:

                    5:39:36: Running steps for project vdec_test...
                    15:39:36: Configuration unchanged, skipping qmake step.
                    15:39:36: Starting: "/usr/bin/make" 
                    arm-hisiv400-linux-g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../../v1_QtEmbedded-4.8.6/mkspecs/qws/linux-hisiv400-arm-g++ -I../vdec_test -I../../v1_QtEmbedded-4.8.6/include/QtCore -I../../v1_QtEmbedded-4.8.6/include/QtNetwork -I../../v1_QtEmbedded-4.8.6/include/QtGui -I../../v1_QtEmbedded-4.8.6/include -I../../mpp_single/sample/common -I../../mpp_single/include -I../../mpp_single/extdrv/tlv320aic31 -I../../v1_QtEmbedded-4.8.6/examples/multimedia/videographicsitem -I../../mpp_single/lib -I../../mpp_single/include -I../../mpp_single/include -I../../mpp_single/include -I../../mpp_single/include -I../../mpp_single/include -I../../mpp_single/include -I. -I. -I../vdec_test -I. -o mainwindow.o ../vdec_test/mainwindow.cpp
                    arm-hisiv400-linux-g++ -Wl,-O1 -Wl,-rpath,/home/aa/Hi3536_SDK_V2.0.4.0/v1_QtEmbedded-4.8.6/lib -o vdec_test main.o mainwindow.o sample_comm_audio.o sample_comm_ivs.o sample_comm_sys.o sample_comm_vda.o sample_comm_vdec.o sample_comm_venc.o sample_comm_vi.o sample_comm_vo.o sample_comm_vpss.o sample_vdec.o moc_mainwindow.o    -L/home/aa/Hi3536_SDK_V2.0.4.0/v1_QtEmbedded-4.8.6/lib -L/home/aa/Hi3536_SDK_V2.0.4.0/Working\ folder/vdec_test/../../mpp_single/lib/ -ldnvqe -lhdmi -lmpi -ljpeg -lupvqe -lVoiceEngine -lQtGui -L/home/aa/Hi3536_SDK_V2.0.4.0/v1_QtEmbedded-4.8.6/lib -lQtNetwork -lQtCore -lm -ldl -lrt -lpthread 
                    mainwindow.o: In function `MainWindow::on_pushButton_clicked()':
                    mainwindow.cpp:(.text+0xbc): undefined reference to `SAMPLE_VDEC_VdhH264()'
                    mainwindow.o: In function `MainWindow::on_pushButton_2_clicked()':
                    mainwindow.cpp:(.text+0xc0): undefined reference to `SAMPLE_VDEC_VdhH265()'
                    collect2: error: ld returned 1 exit status
                    Makefile:125: recipe for target 'vdec_test' failed
                    make: *** [vdec_test] Error 1
                    15:39:37: The process "/usr/bin/make" exited with code 2.
                    Error while building/deploying project vdec_test (kit: HI3536 Qt4.8)
                    When executing step "Make"
                    15:39:37: Elapsed time: 00:01.
                    
                    J Offline
                    J Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on 27 Sept 2016, 07:58 last edited by
                    #23

                    @embdev To me it doesn't look like a complete rebuild as in the second compiler call object files, which were not compiled before, are already linked:

                    arm-hisiv400-linux-g++ -Wl,-O1 -Wl,-rpath,/home/aa/Hi3536_SDK_V2.0.4.0/v1_QtEmbedded-4.8.6/lib -o vdec_test main.o mainwindow.o sample_comm_audio.o sample_comm_ivs.o sample_comm_sys.o sample_comm_vda.o sample_comm_vdec.o sample_comm_venc.o sample_comm_vi.o sample_comm_vo.o sample_comm_vpss.o sample_vdec.o moc_mainwindow.o    -L/home/aa/Hi3536_SDK_V2.0.4.0/v1_QtEmbedded-4.8.6/lib -L/home/aa/Hi3536_SDK_V2.0.4.0/Working\ folder/vdec_test/../../mpp_single/lib/ -ldnvqe -lhdmi -lmpi -ljpeg -lupvqe -lVoiceEngine -lQtGui -L/home/aa/Hi3536_SDK_V2.0.4.0/v1_QtEmbedded-4.8.6/lib -lQtNetwork -lQtCore -lm -ldl -lrt -lpthread
                    

                    Please do a rebuild.
                    In which file is SAMPLE_VDEC_VhdH264() defined?

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    E 1 Reply Last reply 27 Sept 2016, 08:42
                    0
                    • J jsulm
                      27 Sept 2016, 07:58

                      @embdev To me it doesn't look like a complete rebuild as in the second compiler call object files, which were not compiled before, are already linked:

                      arm-hisiv400-linux-g++ -Wl,-O1 -Wl,-rpath,/home/aa/Hi3536_SDK_V2.0.4.0/v1_QtEmbedded-4.8.6/lib -o vdec_test main.o mainwindow.o sample_comm_audio.o sample_comm_ivs.o sample_comm_sys.o sample_comm_vda.o sample_comm_vdec.o sample_comm_venc.o sample_comm_vi.o sample_comm_vo.o sample_comm_vpss.o sample_vdec.o moc_mainwindow.o    -L/home/aa/Hi3536_SDK_V2.0.4.0/v1_QtEmbedded-4.8.6/lib -L/home/aa/Hi3536_SDK_V2.0.4.0/Working\ folder/vdec_test/../../mpp_single/lib/ -ldnvqe -lhdmi -lmpi -ljpeg -lupvqe -lVoiceEngine -lQtGui -L/home/aa/Hi3536_SDK_V2.0.4.0/v1_QtEmbedded-4.8.6/lib -lQtNetwork -lQtCore -lm -ldl -lrt -lpthread
                      

                      Please do a rebuild.
                      In which file is SAMPLE_VDEC_VhdH264() defined?

                      E Offline
                      E Offline
                      embdev
                      wrote on 27 Sept 2016, 08:42 last edited by embdev
                      #24

                      @jsulm I've deleted the object files away in my build-release folder. I think could be due to datatype declaration of my function, when it's invoked as HI_32 SAMPLE_VDEC_VdhH264(); in the main.cpp, then the project can be compiled, i.e.:

                      ** in main.cpp **

                      #include "mainwindow.h"
                      #include "ui_mainwindow.h"
                      #include "hi3536mainfx.h"
                      
                      MainWindow::MainWindow(QWidget *parent) :
                          QMainWindow(parent),
                          ui(new Ui::MainWindow)
                      {
                          ui->setupUi(this);
                      }
                      
                      MainWindow::~MainWindow()
                      {
                          delete ui;
                      }
                      
                      
                      void MainWindow::on_pushButton_clicked()
                      {
                      
                        HI_S32 SAMPLE_VDEC_VdhH264();
                      
                      }
                      J 1 Reply Last reply 27 Sept 2016, 08:49
                      0
                      • E embdev
                        27 Sept 2016, 08:42

                        @jsulm I've deleted the object files away in my build-release folder. I think could be due to datatype declaration of my function, when it's invoked as HI_32 SAMPLE_VDEC_VdhH264(); in the main.cpp, then the project can be compiled, i.e.:

                        ** in main.cpp **

                        #include "mainwindow.h"
                        #include "ui_mainwindow.h"
                        #include "hi3536mainfx.h"
                        
                        MainWindow::MainWindow(QWidget *parent) :
                            QMainWindow(parent),
                            ui(new Ui::MainWindow)
                        {
                            ui->setupUi(this);
                        }
                        
                        MainWindow::~MainWindow()
                        {
                            delete ui;
                        }
                        
                        
                        void MainWindow::on_pushButton_clicked()
                        {
                        
                          HI_S32 SAMPLE_VDEC_VdhH264();
                        
                        }
                        J Offline
                        J Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on 27 Sept 2016, 08:49 last edited by
                        #25

                        @embdev Now you are declaring a function with same name, you are not calling it.
                        Functions are not called like this in C/C++.
                        You should really check your project configuration and sources.

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                        E 1 Reply Last reply 27 Sept 2016, 08:51
                        0
                        • J jsulm
                          27 Sept 2016, 08:49

                          @embdev Now you are declaring a function with same name, you are not calling it.
                          Functions are not called like this in C/C++.
                          You should really check your project configuration and sources.

                          E Offline
                          E Offline
                          embdev
                          wrote on 27 Sept 2016, 08:51 last edited by
                          #26

                          @jsulm I see, project configurations meaning the .pro file?

                          J 1 Reply Last reply 27 Sept 2016, 08:58
                          0
                          • E embdev
                            27 Sept 2016, 08:51

                            @jsulm I see, project configurations meaning the .pro file?

                            J Offline
                            J Offline
                            jsulm
                            Lifetime Qt Champion
                            wrote on 27 Sept 2016, 08:58 last edited by
                            #27

                            @embdev yes

                            https://forum.qt.io/topic/113070/qt-code-of-conduct

                            M 1 Reply Last reply 27 Sept 2016, 09:12
                            1
                            • J jsulm
                              27 Sept 2016, 08:58

                              @embdev yes

                              M Offline
                              M Offline
                              mrjj
                              Lifetime Qt Champion
                              wrote on 27 Sept 2016, 09:12 last edited by
                              #28

                              @jsulm
                              Hi
                              I wonder if
                              extern "c" {
                              #include "hi3536mainfx.h"
                              }

                              is needed?

                              J 1 Reply Last reply 27 Sept 2016, 09:17
                              1
                              • M mrjj
                                27 Sept 2016, 09:12

                                @jsulm
                                Hi
                                I wonder if
                                extern "c" {
                                #include "hi3536mainfx.h"
                                }

                                is needed?

                                J Offline
                                J Offline
                                jsulm
                                Lifetime Qt Champion
                                wrote on 27 Sept 2016, 09:17 last edited by
                                #29

                                @mrjj said in How do i integrate my embedded C source codes (for my embedded linux board) with Qt GUI together?:

                                extern "c"

                                I think it is needed as it is a C header

                                https://forum.qt.io/topic/113070/qt-code-of-conduct

                                M 1 Reply Last reply 27 Sept 2016, 09:21
                                2
                                • J jsulm
                                  27 Sept 2016, 09:17

                                  @mrjj said in How do i integrate my embedded C source codes (for my embedded linux board) with Qt GUI together?:

                                  extern "c"

                                  I think it is needed as it is a C header

                                  M Offline
                                  M Offline
                                  mrjj
                                  Lifetime Qt Champion
                                  wrote on 27 Sept 2016, 09:21 last edited by
                                  #30

                                  @jsulm
                                  Well im not sure. Just realized I never tried a .c file with mingw and see if it will cpp compile it or
                                  it does in fact need extern "c". :)

                                  K 1 Reply Last reply 27 Sept 2016, 09:32
                                  1
                                  • M mrjj
                                    27 Sept 2016, 09:21

                                    @jsulm
                                    Well im not sure. Just realized I never tried a .c file with mingw and see if it will cpp compile it or
                                    it does in fact need extern "c". :)

                                    K Offline
                                    K Offline
                                    kshegunov
                                    Moderators
                                    wrote on 27 Sept 2016, 09:32 last edited by
                                    #31

                                    @mrjj said in How do i integrate my embedded C source codes (for my embedded linux board) with Qt GUI together?:

                                    Well im not sure.

                                    It is absolutely needed. C++ supports overloading (which C obviously doesn't) and that ABI-wise is realized by decorating the symbols. So to be able to link properly, you need to tell the compiler that you're actually expecting C-linkage for the functions.

                                    Read and abide by the Qt Code of Conduct

                                    M 1 Reply Last reply 27 Sept 2016, 09:35
                                    2
                                    • K kshegunov
                                      27 Sept 2016, 09:32

                                      @mrjj said in How do i integrate my embedded C source codes (for my embedded linux board) with Qt GUI together?:

                                      Well im not sure.

                                      It is absolutely needed. C++ supports overloading (which C obviously doesn't) and that ABI-wise is realized by decorating the symbols. So to be able to link properly, you need to tell the compiler that you're actually expecting C-linkage for the functions.

                                      M Offline
                                      M Offline
                                      mrjj
                                      Lifetime Qt Champion
                                      wrote on 27 Sept 2016, 09:35 last edited by mrjj
                                      #32

                                      @kshegunov
                                      Thank you. The reason for my doubts is that my old compiler compiles all as cpp and
                                      hence never needs it. And using Mingw so far, all files been cpp so was not sure if extension .c
                                      would actually trigger different compile. And it does - so that's a key thing for c-files.

                                      1 Reply Last reply
                                      1
                                      • E Offline
                                        E Offline
                                        embdev
                                        wrote on 27 Sept 2016, 09:58 last edited by embdev
                                        #33

                                        @jsulm @mrjj wow, that's really good advice for appending extern "C" { #..... }
                                        After adding this line, my source is able to compile successfully and boot into my embedded target Linux. Of course it's not fully up because my target source code have other issues but I guess on Qt side, it's resolved!

                                        Thank you very much folks!

                                        1 Reply Last reply
                                        2

                                        24/33

                                        27 Sept 2016, 08:42

                                        • Login

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