Results 1 to 4 of 4

Thread: Control doesn't execute one of the C functions that I call

  1. #1
    Join Date
    Oct 2015
    Posts
    35
    Thanks
    11
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11

    Default Control doesn't execute one of the C functions that I call

    Hello All,

    I have few C files my project and from my mainwindow.cpp file I'm calling one of the function that is defined in one of the C file, but the control doesn't go into(execute) the function that I'm calling. Could someone please help me in fixing this. Thanks in advance. Following is the code.

    in mainwindow.cpp file

    Qt Code:
    1. // Other include headers
    2. #ifdef __cplusplus
    3. extern "C"{
    4. #include "c_s.h"
    5. #include "c_s.c"
    6. //Other part of the code
    7. void MainWindow::u_data(void)
    8. {
    9. //other code
    10. m_VT(&pt1);
    To copy to clipboard, switch view to plain text mode 

    in c_s.c file
    Qt Code:
    1. void m_VT(struct vt_data *out){
    2.  
    3. //do something
    4. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Oct 2009
    Posts
    483
    Thanked 97 Times in 94 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Control doesn't execute one of the C functions that I call

    I would say that no one ever calls MainWindow::u_data(). Of course, I would need the whole program to know for sure.

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Control doesn't execute one of the C functions that I call

    General observation on the snippet presented:
    1. Close the braces around the extern "C" { } block.
    2. #include is not usually used to pull in implementation code. Move c_s.c to SOURCES in your qmake PRO file and remove the #include.


    Apart from that there's little to be said without more information

  4. The following user says thank you to ChrisW67 for this useful post:

    rookee (4th January 2016)

  5. #4
    Join Date
    Oct 2015
    Posts
    35
    Thanks
    11
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Control doesn't execute one of the C functions that I call

    Thanks very much!! It worked after making changes you suggested and a few more.

Similar Threads

  1. Replies: 5
    Last Post: 10th March 2011, 18:16
  2. Cannot call OpenCV 2.0 functions inside Qt slots
    By Asfer in forum Qt Programming
    Replies: 2
    Last Post: 19th February 2010, 11:48
  3. PyQt4 doesn't execute eventFilter()
    By akiross in forum Newbie
    Replies: 0
    Last Post: 29th October 2008, 01:18
  4. Replies: 3
    Last Post: 4th March 2008, 08:35
  5. virtual overloaded functions and base class function call...
    By nouknouk in forum General Programming
    Replies: 7
    Last Post: 11th March 2006, 21:26

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.