PlatformIO Community

How do I add.lib files

How do I add.lib files

src/main.c:36: warning: ignoring #pragma comment [-Wunknown-pragmas]
36 | #pragma comment(lib, “lib/xxx.lib”)

.lib sounds very Microsoft Visual C/C++ like. Are you working with platform = native and want to add a precompiled .lib file? With what compiler was that generated? Remember PlatformIO uses GCC, not MVC…

This file contains some function implementations that others have hidden

That answered none of the questions I asked

platform = gd32 and want to add a .lib file

What is this file compiled with I don’t know, maybe keil

Again, PlatformIO uses GCC. There are people in Link an ARMCC (Keil MDK) precompiled lib to a GCC project - Page 1 which say that it is compatible and other say it isn’t.

You can use the standard build_flags to try to link the library.

build_flags =
   -Llib/
   -lxxx

if libxx.lib is in lib/. (-L adds a folder to the search path, -l<name> links a specifc library file – the initial lib in the filename is often times omitted).