You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Library projects contain their sources in src/ and include/ and don't have a main() function. Building such a project first compiles the code and subsequently tries to link it unnecessarily. The linker, however, fails by complaining about a missing main() or missing setup() and loop() (depending on whether, e.g., the arduino framework is in use).
There is no project parameter in platformio.ini to tell pio not to link a library project. There is also no build parameter to the compiler (eg. gcc) to suppress the linker since the linker is started exclusively by pio. A custom build script could be used, but it should not be required for a common task like building a library project.
Expected behavior
Building a library project should contain the steps of compiling, optionally creating a library archive (.a), and optionally including an archive index, but no linking step.
A project should be markable as a library project in platformio.ini (eg. type = library with type defaulting to application) to omit the linking step and avoid a linking error and hence a build error.
Additionally, a compile-only build option should exist that compiles without linking to quickly build a library project or check the code for compile errors on any project, saving the linker time.
The text was updated successfully, but these errors were encountered:
Problem
Library projects contain their sources in
src/
andinclude/
and don't have amain()
function. Building such a project first compiles the code and subsequently tries to link it unnecessarily. The linker, however, fails by complaining about a missingmain()
or missingsetup()
andloop()
(depending on whether, e.g., the arduino framework is in use).There is no project parameter in
platformio.ini
to tell pio not to link a library project. There is also no build parameter to the compiler (eg. gcc) to suppress the linker since the linker is started exclusively by pio. A custom build script could be used, but it should not be required for a common task like building a library project.Expected behavior
Building a library project should contain the steps of compiling, optionally creating a library archive (.a), and optionally including an archive index, but no linking step.
platformio.ini
(eg.type = library
withtype
defaulting toapplication
) to omit the linking step and avoid a linking error and hence a build error.The text was updated successfully, but these errors were encountered: