LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

integrating C++ codes in Labwindows

I dont understand what you meant. sry."different declarations of your function"??? But the whole prgrm in the "square.c" worked successfully as a seperate win32 console application.

 

sry for the hard to read attachment. u could see it better if you download n open n zoom&view.

Nghtcwrlr

---------------------------------------------------------------------------------------------
*************************************
---------------------------------------------------------------------------------------------
0 Kudos
Message 21 of 26
(1,183 Views)

1) in square.h you have a function square ( double x);

 

2) in square.c your function is square ( int argc, char * argv [] )

 

Obviously this is the same function name but with different parameters...

 

Probably in your C code it should read main () instead of square ()...

 

 

0 Kudos
Message 22 of 26
(1,175 Views)

Does that mean i have to change

 double square(int argc, char* argv[]);------>  main(double x);

 

in square.c file??

Nghtcwrlr

---------------------------------------------------------------------------------------------
*************************************
---------------------------------------------------------------------------------------------
0 Kudos
Message 23 of 26
(1,168 Views)

just to remind you: this is a forum on CVI, not on learning C. Once in a while you might want to consult your C book or the link I've posted earlier...

 

This said, if you are trying to compile a program, you will need a main (int argc, char* argv[]).

 

Within this main, you may call functions such as your square ( ).

0 Kudos
Message 24 of 26
(1,164 Views)

ok... sorry for the inconvienence. I ll now try to figure it out by brushing up my C knowledge...

 

thankyou vry much

Nghtcwrlr

---------------------------------------------------------------------------------------------
*************************************
---------------------------------------------------------------------------------------------
0 Kudos
Message 25 of 26
(1,122 Views)

I tried to modfiy it. Now the compiling is ok. But when i call the function squaren in the main program, there comes error in egtting value from the control. I need to get values of period and amplitude from the uir control. I use the following command for it:

double *pt_p;
		double *pt_a;
		pt_p = &p;
		pt_a = &a;

		GetCtrlVal ( panelHandle, PANEL_NUMERIC_2, pt_p );

		GetCtrlVal ( panelHandle, PANEL_NUMERIC_1, pt_a );

		//double x;
		// Period and amplitude.
		const double period = (p/2);
		double amplitude = a ;

 

pt_p,pt_a are the values obtained from uir control and they are assigned to p and a . Is that correct???

Nghtcwrlr

---------------------------------------------------------------------------------------------
*************************************
---------------------------------------------------------------------------------------------
0 Kudos
Message 26 of 26
(1,079 Views)