API problem using mingw-w64 gcc

Post your C and C++ discussions here
Post Reply
jenilsen
Newbie
Posts: 1
Joined: Fri Dec 07, 2018 2:14 pm

API problem using mingw-w64 gcc

Post by jenilsen » Thu Dec 20, 2018 10:04 am

Hi
I am working on a project with PS2206B.
The OS is Win10 pro. Compiled with MSVC, the example ps2000aCon.c runs fine.
Compiled with mingw-w64, using ps2000a 64-bit library (I have to fix warnings on "scanf_s" and "fscanf_s" first):
gcc ps2000aCon.c -o ps.exe -L. -lps2000a
I get many errors like these:
undefined reference to `_imp__ps2000aCloseUnit@4'
undefined reference to `_imp__ps2000aSetEts@20'

Then I compile with MinGW_64, using ps2000a 32-bit library. The compilation goes fine and I can run the ps.exe program, but it won't work:
> ./ps
PicoScope 2000 Series (A API) Driver Example Program
Version 2.3

Opening the device...
Handle: -1
Unable to open device
Error code : 78

What is wrong? And by the way, Merry Christmas :D

Martyn
Site Admin
Site Admin
Posts: 3711
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: API problem using mingw-w64 gcc

Post by Martyn » Mon Jan 14, 2019 7:55 am

Sorry for the delay in responding, are you are still having difficulties ?

Error 78 is // FPGA not successfully set up.
#define PICO_FPGA_FAIL 0x0000004EUL

which seems a bit odd.

Have you installed both the 32bit and 64bit SDK's on your PC and are correctly linking to them ?

Does the MSVC compilation work for both 32bit and 64bit CPU types ?
Martyn
Technical Support Manager

jenilsen
Newbie
Posts: 1
Joined: Fri Dec 07, 2018 2:14 pm

Re: API problem using mingw-w64 gcc

Post by jenilsen » Mon Jan 14, 2019 8:20 am

Hi Martyn
Thank you for answer.
mingw-w64 does not "understand" 64-bit MSVC library files, so I have focused on 32-bit SDK. I have tried with both 32bit and 64bit SDK's installed, one by one, not simultanuous.
Command line: gcc ps2000aCon.c -o ps.exe -L. -lps2000a (With 32-bit lib2000a.lib in directory ".")
MSVC compilation work for 64bit CPU type. I have not tested 32bit.

Martyn
Site Admin
Site Admin
Posts: 3711
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: API problem using mingw-w64 gcc

Post by Martyn » Mon Jan 14, 2019 9:03 am

Are you using our example code from GitHub ?
Martyn
Technical Support Manager

jenilsen
Newbie
Posts: 1
Joined: Fri Dec 07, 2018 2:14 pm

Re: API problem using mingw-w64 gcc

Post by jenilsen » Mon Jan 14, 2019 9:19 am

Yes, I used your example code from GitHub as is, just fixing warnings on "scanf_s" and "fscanf_s" first.

Martyn
Site Admin
Site Admin
Posts: 3711
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: API problem using mingw-w64 gcc

Post by Martyn » Tue Jan 15, 2019 9:02 am

I would try adding the full Library Path, that has fixed similar errors for other MinGW users.
Martyn
Technical Support Manager

jenilsen
Newbie
Posts: 1
Joined: Fri Dec 07, 2018 2:14 pm

Re: API problem using mingw-w64 gcc

Post by jenilsen » Mon Feb 04, 2019 3:39 pm

Using the full Library Path, instead of '.' fixed the problem. Many thank :D

Post Reply