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.0k 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.
  • jsulmJ jsulm

    @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?

    embdevE Offline
    embdevE Offline
    embdev
    wrote on 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();
    
    }
    jsulmJ 1 Reply Last reply
    0
    • embdevE embdev

      @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();
      
      }
      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on 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

      embdevE 1 Reply Last reply
      0
      • jsulmJ jsulm

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

        embdevE Offline
        embdevE Offline
        embdev
        wrote on last edited by
        #26

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

        jsulmJ 1 Reply Last reply
        0
        • embdevE embdev

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

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #27

          @embdev yes

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

          mrjjM 1 Reply Last reply
          1
          • jsulmJ jsulm

            @embdev yes

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

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

            is needed?

            jsulmJ 1 Reply Last reply
            1
            • mrjjM mrjj

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

              is needed?

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on 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

              mrjjM 1 Reply Last reply
              2
              • jsulmJ jsulm

                @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

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on 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". :)

                kshegunovK 1 Reply Last reply
                1
                • mrjjM mrjj

                  @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". :)

                  kshegunovK Offline
                  kshegunovK Offline
                  kshegunov
                  Moderators
                  wrote on 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

                  mrjjM 1 Reply Last reply
                  2
                  • kshegunovK kshegunov

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

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on 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
                    • embdevE Offline
                      embdevE Offline
                      embdev
                      wrote on 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

                      • Login

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