ZakKemble / libmcp2221

MCP2221 HID Library
https://blog.zakkemble.net/mcp2221-hid-library/
GNU General Public License v3.0
53 stars 14 forks source link

compile with mingw #8

Closed numeru55 closed 1 year ago

numeru55 commented 1 year ago
PS C:\Users\numeru55\Downloads\libmcp2221-master\libmcp2221-master\examples\gpio> mingw32-make.exe
gcc -s main.o -lmcp2221 -o gpio
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: main.o:main.c:(.text.startup+0x25): undefined reference to `mcp2221_init'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: main.o:main.c:(.text.startup+0x5d): undefined reference to `mcp2221_find'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: main.o:main.c:(.text.startup+0x7e): undefined reference to `mcp2221_open'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: main.o:main.c:(.text.startup+0xab): undefined reference to `mcp2221_GPIOConfInit'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: main.o:main.c:(.text.startup+0xe8): undefined reference to `mcp2221_setGPIOConf'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: main.o:main.c:(.text.startup+0xf7): undefined reference to `mcp2221_saveGPIOConf'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: main.o:main.c:(.text.startup+0x133): undefined reference to `mcp2221_readGPIO'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: main.o:main.c:(.text.startup+0x167): undefined reference to `mcp2221_exit'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: main.o:main.c:(.text.startup+0x1ba): undefined reference to `mcp2221_setGPIO'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: main.o:main.c:(.text.startup+0x1e9): undefined reference to `mcp2221_readGPIO'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: main.o:main.c:(.text.startup+0x22f): undefined reference to `mcp2221_setGPIO'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: main.o:main.c:(.text.startup+0x25e): undefined reference to `mcp2221_readGPIO'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: main.o:main.c:(.text.startup+0x2a4): undefined reference to `mcp2221_setGPIO'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: main.o:main.c:(.text.startup+0x2b6): undefined reference to `mcp2221_exit'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: main.o:main.c:(.text.startup+0x302): undefined reference to `hid_error'
collect2.exe: error: ld returned 1 exit status
Makefile:32: recipe for target 'gpio' failed
mingw32-make: *** [gpio] Error 1
PS C:\Users\numeru55\Downloads\libmcp2221-master\libmcp2221-master\examples\gpio>
numeru55 commented 1 year ago

sorry, solved. seems well compiled.

(on wsl)

numeru55@aaaa:~/libmcp2221/examples/gpio$ x86_64-w64-mingw32-gcc -g -c main.c ../../libmcp2221/hid.c ../../libmcp2221/libmcp2221.c
In file included from main.c:16:
../../libmcp2221/win/win.h:15: warning: "_WIN32_WINNT" redefined
   15 | #define _WIN32_WINNT 0x0501
      |
In file included from /usr/share/mingw-w64/include/corecrt.h:10,
                 from /usr/share/mingw-w64/include/crtdefs.h:10,
                 from /usr/share/mingw-w64/include/stdio.h:9,
                 from main.c:15:
/usr/share/mingw-w64/include/_mingw.h:234: note: this is the location of the previous definition
  234 | #define _WIN32_WINNT 0x502
      |
numeru55@aaaa:~/libmcp2221/examples/gpio$ x86_64-w64-mingw32-gcc -g hid.o libmcp2221.o main.o -lsetupapi -o main.exe
numeru55@aaaa:~/libmcp2221/examples/gpio$ ls
Makefile  gpio  gpio.exe  hid.o  libmcp2221.dll  libmcp2221.o  main.c  main.exe  main.o
numeru55@aaaa:~/libmcp2221/examples/gpio$ ./main.exe
Starting!
Looking for devices... found 0 devices
Opening device... No MCP2221s found
numeru55@aaaa:~/libmcp2221/examples/gpio$
numeru55 commented 1 year ago

sorry again and again

PS >mingw32-gcc.exe  ..\..\libmcp2221\hid.c ..\..\libmcp2221\libmcp2221.c main.c  -lsetupapi -o gpio.exe