PDA

View Full Version : Control doesn't execute one of the C functions that I call



rookee
4th January 2016, 14:27
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



// Other include headers
#ifdef __cplusplus
extern "C"{
#include "c_s.h"
#include "c_s.c"
//Other part of the code
void MainWindow::u_data(void)
{
//other code
m_VT(&pt1);


in c_s.c file


void m_VT(struct vt_data *out){

//do something
}

yeye_olive
4th January 2016, 16:33
I would say that no one ever calls MainWindow::u_data(). Of course, I would need the whole program to know for sure.

ChrisW67
4th January 2016, 20:07
General observation on the snippet presented:

Close the braces around the extern "C" { } block.
#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

rookee
4th January 2016, 22:18
Thanks very much!! It worked after making changes you suggested and a few more.