04-21-2010 11:46 AM
I am trying to read cells from an excel file and store the contents into variables. The idea is to pass in info such as test numbers, high/low limits, ect.
I've looked through the activex/excel samples and found excel2000dem which has a function called ReadDataFromExcel. I've copied that plus the
excel2000.h file, plus other variables and defines that it seemed to need. I get no errors for a build/compile but when I shift/F5, I get 7 link errors
for Undefined symbols such as '_ExcelSheetsItem @28' and '_ExcelWorkbooksOpen@208' . I'm new to LabWindows so I'm not sure how to
track down a link error. Can someone point me in the right direction?
Mike
Solved! Go to Solution.
04-21-2010 12:19 PM
You need to add the excel instrument. Go to Instrument at the top and select load instrument. Go into the activeX folder and then the excel folder. There will be two instruments: excel2000.fp and excelreport.fp. Load each one of those and then try your program and let me know if that works.
Tony
04-21-2010 12:40 PM
Yes, that fixed the above problem. Thank You!
Now, the next problem is I have 2 compile errors:
1. When I call ReadDataFromExcel, I get a Missing prototype. (Require function prototypes build option is enabled.) error.
2. At the ReadDataFromExcel function, I get a Redeclaration of 'ReadDataFromExcel' previously declared error which points to where I'm calling it.
Mike
04-21-2010 01:06 PM
ok. The ReadDataFromExcel function is not defined in the excel instruments. Even though you selected to require prototypes, it doesn't make the prototypes. So up at the top before your main function, put a prototype for ReadDataFromExcel. I see in this example that many of the functions used are user made by the designer. Try including the prototype and let me know how it goes.
Tony
04-21-2010 01:45 PM
Tony,
Thanks, that seemd to work too. Odd thing is that I had closed the program and now that I've reloaded it, the instruments were not loaded anymore.
Should they stick when LabWindows is closed or do they need to be reloaded every time? Now that I've reloaded them, I've got the same original link
errors again for the undefined symbols.
Mike
04-21-2010 02:07 PM
oh ya. Go into edit and roll over "add files to project" and then select the excel2000.fp and excelreport.fp instruments. This way they are included whenever you open up that project. See how this does.
Tony
04-21-2010 03:37 PM
Tony,
That fixed the issue with the instrument files being locked to the program. I'm still stuck back to the undefined symbol problem. I noticed that the demo program only uses excel2000.fp so I removed excelreport.fp . Still have the same problem. It's odd that it fixed it the first time around but now doesn't.
Mike
04-21-2010 04:05 PM
Mike,
First make sure the excel2000.h file is in the include section at the top, otherwise can you post what the error says exactly and for what function? Thanks.
04-21-2010 04:31 PM
Tony,
Here are the error messages. I only get it when the ReadDataFromExcel function is in the program. If I comment out the function, there are no errors.
7 Project link errors
Undefined symbol '_Excel_GetProperty@20' referenced in "Sirius_rev1.c".
Undefined symbol '_Excel_WorksheetActivate@8' referenced in "Sirius_rev1.c".
Undefined symbol '_Excel_WorksheetRange@44' referenced in "Sirius_rev1.c".
Undefined symbol '_Excel_SheetsItem@28' referenced in "Sirius_rev1.c".
Undefined symbol '_Excel_WorkbooksOpen@208' referenced in "Sirius_rev1.c".
Undefined symbol '_Excel_RangeActivate@12' referenced in "Sirius_rev1.c".
Undefined symbol '_Excel_RangeGetItem@44' referenced in "Sirius_rev1.c".
Mike
04-21-2010 04:51 PM