Hi,
A friend of mine has asked me to create a nice GUI to go along with his C-application. It's an application that's capable of reconfiguring an Anadigm-chip, but that's besides the point.
The C-application compiles and runs without a problem. My friend wrote the main program himself, but the rest of the files (ApiCode.h, ApiCode.c, CAMCode.h, CAMCode.c) were generated by an Anadigm-tool.
I assumed I could keep the Anadigm files, and only had to rewrite the main program using Qt. I compiled the program in the console with qmake -project, qmake and make. This time around, the compiler gave the following warnings:
ApiCode.c:207: warning: ‘an_FPAA1_InputCell1_IOCell’ initialized and declared ‘extern’
ApiCode.c:218: warning: ‘an_FPAA1_InputCell2_IOCell’ initialized and declared ‘extern’
ApiCode.c:229: warning: ‘an_FPAA1_InputCell3_IOCell’ initialized and declared ‘extern’
ApiCode.c:240: warning: ‘an_FPAA1_InputCell4_IOCell’ initialized and declared ‘extern’
ApiCode.c:251: warning: ‘an_FPAA1_OutputCell1_IOCell’ initialized and declared ‘extern’
ApiCode.c:262: warning: ‘an_FPAA1_OutputCell2_IOCell’ initialized and declared ‘extern’
ApiCode.c:273: warning: ‘an_FPAA1_filt0_0_Capacitor’ initialized and declared ‘extern’
ApiCode.c:286: warning: ‘an_FPAA1_filt1_0_Capacitor’ initialized and declared ‘extern’
ApiCode.c:299: warning: ‘an_FPAA1_filt2_1_Capacitor’ initialized and declared ‘extern’
ApiCode.c:312: warning: ‘an_FPAA1_filt3_1_Capacitor’ initialized and declared ‘extern’
ApiCode.c:207: warning: ‘an_FPAA1_InputCell1_IOCell’ initialized and declared ‘extern’
ApiCode.c:218: warning: ‘an_FPAA1_InputCell2_IOCell’ initialized and declared ‘extern’
ApiCode.c:229: warning: ‘an_FPAA1_InputCell3_IOCell’ initialized and declared ‘extern’
ApiCode.c:240: warning: ‘an_FPAA1_InputCell4_IOCell’ initialized and declared ‘extern’
ApiCode.c:251: warning: ‘an_FPAA1_OutputCell1_IOCell’ initialized and declared ‘extern’
ApiCode.c:262: warning: ‘an_FPAA1_OutputCell2_IOCell’ initialized and declared ‘extern’
ApiCode.c:273: warning: ‘an_FPAA1_filt0_0_Capacitor’ initialized and declared ‘extern’
ApiCode.c:286: warning: ‘an_FPAA1_filt1_0_Capacitor’ initialized and declared ‘extern’
ApiCode.c:299: warning: ‘an_FPAA1_filt2_1_Capacitor’ initialized and declared ‘extern’
ApiCode.c:312: warning: ‘an_FPAA1_filt3_1_Capacitor’ initialized and declared ‘extern’
To copy to clipboard, switch view to plain text mode
Those variables are declared 'extern' everywhere: I can't seem to find a regular declaration. Why is this okay with the C-compiler, while the C++-compiler issues warnings?
Anyway, the program compiled successfully. It runs perfectly, until I press the button "Genereer stream" ("Generate stream"): the program crashes with a segmentation fault. Experience has taught me that these things happen when you try to access a variable which hasn't been assigned memory. Is there a connection with the warnings above?
Apparently, the lines in anadigmform.cpp that are causing the crash are the following:
an_SetBQLowPassFilterI(6, 0.200, 1, 1.30651);
an_SetBQLowPassFilterI(7, 0.200, 1, 1.30651);
an_SetBQLowPassFilterI(6, 0.200, 1, 1.30651);
an_SetBQLowPassFilterI(7, 0.200, 1, 1.30651);
To copy to clipboard, switch view to plain text mode
In short: I've given myself a headache looking for an explanation, but I can't seem to find a reason for the crashing. Does anyone have an idea? And can I mix C and Qt like this?
You can find the files here.
Thanks.
Bookmarks