Test and Measurement Forum

link error in C example

Post your C and C++ discussions here

link error in C example

Postby fabienL » Wed Sep 09, 2015 10:42 am

Hi guys,

I use the ps2000a SDK stable version to recover data with my picoscope 2208A. I would to use the C code example so I follow instructions in this file

* To build this application:
* Set up a project for a 32-bit console mode application
* Add this file to the project
* Add PS2000A.lib to the project
* Add ps2000aApi.h and picoStatus.h to the project
* Build the project*

I created a 32-bit console application project on visual C++ 2008 and I add required files. I have indicated the library path on project properties like this :

Project Properties -> Linker -> Input -> Additional Dependencies.
Project Properties -> Linker -> General -> Additional Library Directory.

But when I build the project, he compile, but there is many link errors. I saw that is in link with the ps2000a.lib but i don't understand how to fix that... So if someone have an idea thank in advance.

Regards,

Fabien L.

Output debug:

1>Linking...
1>ps2000acon.obj : error LNK2019: unresolved external symbol __imp__ps2000aCloseUnit@4 referenced in function _CloseDevice
1>ps2000acon.obj : error LNK2019: unresolved external symbol __imp__ps2000aSetChannel@24 referenced in function _SetDefaults
1>ps2000acon.obj : error LNK2019: unresolved external symbol __imp__ps2000aSetEts@20 referenced in function _SetDefaults
1>ps2000acon.obj : error LNK2019: unresolved external symbol __imp__ps2000aSetDigitalPort@16 referenced in function _SetDigitals
1>ps2000acon.obj : error LNK2019: unresolved external symbol __imp__ps2000aSetDataBuffer@24 referenced in function _ClearDataBuffers
1>ps2000acon.obj : error LNK2019: unresolved external symbol __imp__ps2000aSetDataBuffers@28 referenced in function _ClearDataBuffers
1>ps2000acon.obj : error LNK2019: unresolved external symbol __imp__ps2000aStop@4 referenced in function _BlockDataHandler
1>ps2000acon.obj : error LNK2019: unresolved external symbol __imp__ps2000aGetValues@28 referenced in function _BlockDataHandler
1>ps2000acon.obj : error LNK2019: unresolved external symbol __imp__ps2000aRunBlock@36 referenced in function _BlockDataHandler
1>ps2000acon.obj : error LNK2019: unresolved external symbol __imp__ps2000aGetTimebase@28 referenced in function _BlockDataHandler
1>ps2000acon.obj : error LNK2019: unresolved external symbol __imp__ps2000aGetStreamingLatestValues@12 referenced in function _StreamDataHandler
1>ps2000acon.obj : error LNK2019: unresolved external symbol __imp__ps2000aRunStreaming@36 referenced in function _StreamDataHandler
1>ps2000acon.obj : error LNK2019: unresolved external symbol __imp__ps2000aSetTriggerDigitalPortProperties@12 referenced in function _SetTrigger
1>ps2000acon.obj : error LNK2019: unresolved external symbol __imp__ps2000aSetPulseWidthQualifier@28 referenced in function _SetTrigger
1>ps2000acon.obj : error LNK2019: unresolved external symbol __imp__ps2000aSetTriggerDelay@8 referenced in function _SetTrigger
1>ps2000acon.obj : error LNK2019: unresolved external symbol __imp__ps2000aSetTriggerChannelDirections@28 referenced in function _SetTrigger
1>ps2000acon.obj : error LNK2019: unresolved external symbol __imp__ps2000aSetTriggerChannelConditions@12 referenced in function _SetTrigger
1>ps2000acon.obj : error LNK2019: unresolved external symbol __imp__ps2000aSetTriggerChannelProperties@20 referenced in function _SetTrigger
1>ps2000acon.obj : error LNK2019: unresolved external symbol __imp__ps2000aGetValuesBulk@28 referenced in function _CollectRapidBlock
1>ps2000acon.obj : error LNK2019: unresolved external symbol __imp__ps2000aGetNoOfCaptures@8 referenced in function _CollectRapidBlock
1>ps2000acon.obj : error LNK2019: unresolved external symbol __imp__ps2000aSetNoOfCaptures@8 referenced in function _CollectRapidBlock
1>ps2000acon.obj : error LNK2019: unresolved external symbol __imp__ps2000aMemorySegments@12 referenced in function _CollectRapidBlock
1>ps2000acon.obj : error LNK2019: unresolved external symbol __imp__ps2000aGetUnitInfo@20 referenced in function _get_info
1>ps2000acon.obj : error LNK2019: unresolved external symbol __imp__ps2000aSetSigGenBuiltIn@60 referenced in function _SetSignalGenerator
1>ps2000acon.obj : error LNK2019: unresolved external symbol __imp__ps2000aSetSigGenArbitrary@68 referenced in function _SetSignalGenerator
1>ps2000acon.obj : error LNK2019: unresolved external symbol __imp__ps2000aSigGenFrequencyToPhase@24 referenced in function _SetSignalGenerator
1>ps2000acon.obj : error LNK2019: unresolved external symbol __imp__ps2000aMaximumValue@8 referenced in function _OpenDevice
1>ps2000acon.obj : error LNK2019: unresolved external symbol __imp__ps2000aOpenUnit@8 referenced in function _OpenDevice
1>C:\Users\Labo\Documents\Test_acquisition_picoscope\test10\test10\Debug\test10.exe : fatal error LNK1120: 28 unresolved externals
1>Build log was saved at "file://c:\Users\Labo\Documents\Test_acquisition_picoscope\test10\test10\Debug\BuildLog.htm"
1>test10 - 29 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
fabienL
Newbie
 
Posts: 0
Joined: Wed Sep 09, 2015 10:15 am

Re: link error in C example

Postby Hitesh » Thu Sep 10, 2015 2:11 pm

Hi fabienL,

Did you install the 32-bit or 64-bit SDK?

In your Project Properties -> Linker -> Input -> Additional Dependencies entry, did you add ps2000a.lib to the list?

Alternatively, have you added the lib file to the project in the Solution Explorer?

Regards,
Hitesh

Technical Specialist
Pico Technology
Hitesh
Site Admin
Site Admin
 
Posts: 2314
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: link error in C example

Postby fabienL » Wed Sep 16, 2015 9:21 am

Hi Hitesh,

thanks for your reply,

I installed the 64-bit SDK version (my system is a 64-bit system).

I added "ps2000a.lib" in my project like that Project Properties -> Linker -> Input -> Additional Dependencies

And I specify the path "C:\Users\Labo\Documents\Test_acquisition_picoscope\test60" (test60 is the project directory)
in Project Properties -> Linker -> General-> Additional Library Directories

I also specify the path for header files in Project Properties -> C/C++-> General-> Additional Include Directories

All files i need are in my project directory (test60) and I added them to the project in the solution explorer. But Visual return error link (as you can see in my first post). So if you have any idea...

Regards,

FabienL
fabienL
Newbie
 
Posts: 0
Joined: Wed Sep 09, 2015 10:15 am

Re: link error in C example

Postby Hitesh » Wed Sep 16, 2015 9:26 am

Hi FabienL,

Try setting the paths to the location where the SDK installed the files.

Header files (Project Properties -> C/C++-> General-> Additional Include Directories):

Code: Select all
C:\Program Files\Pico Technology\SDK\inc

Lib files (Project Properties -> Linker -> General-> Additional Library Directories):

Code: Select all
C:\Program Files\Pico Technology\SDK\lib

Are you building a 64-bit application and have you checked to see whether it is the Debug or Release mode that is being built?

Regards,
Hitesh

Technical Specialist
Pico Technology
Hitesh
Site Admin
Site Admin
 
Posts: 2314
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: link error in C example

Postby DanielB » Tue Dec 20, 2016 12:57 pm

Hi guys,

I do have the same problem here, I use the ps2000a SDK stable version (64 bit) trying to receive some data from my Picoscope 2005A.

I followed the instructions just like fabienL did and I get the same Problems.

I created a 32-bit console application project on visual studio community 2015.

Also I set the paths for the Header and Lib files to the location where SDK installed the files.

The Debug Mode is being built.

I have no idea why I still get the same errors. So any help provided by you would be very appreciated.

Regards,

DanielB
DanielB
Newbie
 
Posts: 0
Joined: Tue Dec 20, 2016 12:33 pm

Re: link error in C example

Postby Hitesh » Tue Dec 20, 2016 1:41 pm

Hi DanielB,

Which device are you using as the 2005A is not one of our model numbers.

If you are using a PicoScope 2205A, you need to use the C example solution from the C:\PicoSDK\PS2000\C console directory if you have installed the SDK.

If you are using a PicoScope 2405A, please e-mail support@picotech.com and we can provide an updated example and drivers for you.

Regards,
Hitesh

Technical Specialist
Pico Technology
Hitesh
Site Admin
Site Admin
 
Posts: 2314
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: link error in C example

Postby DanielB » Mon Jan 02, 2017 1:04 pm

Hi Hitesh,

thank you very much for your advice!
Since I switched to your suggested directory and files everything is working.

Regards

DanielB
DanielB
Newbie
 
Posts: 0
Joined: Tue Dec 20, 2016 12:33 pm

Re: link error in C example

Postby Michal T » Thu Apr 27, 2017 1:22 pm

Hi!
I'm using Pico 3406D MSO and have the same problem. I'm using VS Express 2015, added directories to correct fields in project - but I'm still getting an error. Intellisense sees header, but on linking stage I get Severity Code
Error LNK2001 unresolved external symbol ps3000aOpenUnit

Could someone point me in a right direction on what to do next ?

BR
M.T.
Michal T
Newbie
 
Posts: 0
Joined: Thu Apr 27, 2017 1:16 pm

Re: link error in C example

Postby Hitesh » Tue May 02, 2017 8:35 am

Hi M. T.,

Have you tried using the latest examples file from our GitHub repository?

Have you installed the 32-bit or 64-bit PicoSDK?

Regards,
Hitesh

Technical Specialist
Pico Technology
Hitesh
Site Admin
Site Admin
 
Posts: 2314
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire


Return to C and C++

Who is online

Users browsing this forum: No registered users and 0 guests