Author |
Topic |
|
sjwerkema
USA
2 Posts |
Posted - 01/30/2016 : 8:05:20 PM
|
Origin Ver. and Service Release: 8.6.0 (64-bit) Sr3 Operating System: Windows 7
I am trying to create a user-defined fitting function that calls functions that I've written in Origin C. If I include the header file that contains the declarations I need and my function prototypes, I get a "Error, duplicate variable names in declaration" error for the first declaration in the header file when I attempt to compile. If I don't include this header, the compiler complains because it can't find my functions. What is the procedure for using my own code in a fitting function?
Steve Werkema Fermi National Accelerator Laboratory |
|
jasonzhao
China
262 Posts |
Posted - 02/01/2016 : 05:09:43 AM
|
Hello,
Would you please tell me the path of your 'header file' and corresponding '.c' file, and the code of how do you include the header file that contains the declarations, and it's better to show us the prototype of the Origin C function.
Best regards! Jason OriginLab Technical Service |
|
|
sjwerkema
USA
2 Posts |
Posted - 02/01/2016 : 09:05:43 AM
|
Hi Jason,
Thanks for the quick response.
The path of my header file and correspoonding '.c' file is: Z:\Projects\Origin\OriginC\ProjectTemp\MagnetMeasurementAnalysis.h Z:\Projects\Origin\OriginC\ProjectTemp\MagnetMeasurementAnalysis.c
Z: is a network drive.
These files show up in my Origin User folder and build without error. I can use functions defined in MagnetMeasurementAnalysis.c to set column values for worksheets that are in my project.
I include these files in my fitting function with the statement: #include "Z:\Projects\Origin\OriginC\ProjectTemp\MagnetMeasurementAnalysis.h"
The prototype statement (in MagnetMeasurementAnalysis.h) for the function I use in my fitting function is: int Fact(int n);
I can email the code to you if that would help.
Regards,
Steve Werkema Fermi National Accelerator Laboratory |
|
|
jasonzhao
China
262 Posts |
Posted - 02/01/2016 : 9:26:54 PM
|
Hello,
In fact Origin has the fact function internal, http://www.originlab.com/doc/LabTalk/ref/Fact-func you can call it directly in your function expression;
If you write the fact function by yourself, you may need to consider the data type, because in Origin C fitting function, the parameter has a default type of double, but your Fact function has a return type of int, you may need to convert, if necessary.
and if you want us to check the file, you can send to tech@originlab.com.
Best regards! Jason OriginLab Technical Service |
|
|
|
Topic |
|
|
|