Page 1 of 1

Unable to access stdio.h library

Posted: 06 Apr 2021 22:16
by Ladum
Hi all,

I'm currently working on a project that requires the use of the sprintf function but I am unable to access the stdio.h library on the Necto Studio IDE (Specfically for ARM compilers). I've already searched the library manager, and reinstalled the compiler thinking it might have been an issue with installing the standard C libraries. Below is some sample code, the error for me popping up on the sprintf line, because the program is creating a blank library for stdio.h. Any help is appreciated, thanks!

#include "board.h"
#include "stdio.h"


void application_init()
{
char string[20];
uint8_t num = 12;
sprintf(num, "A dozen is %u /r/n", num);
}

/// @brief Application task.
void application_task()
{
}

/// @brief Application main function.
void main(void)
{
application_init();
while (1)
{
application_task();
}
}

Re: Unable to access stdio.h library

Posted: 08 Apr 2021 11:47
by filip
Hi,

Did you choose mikroSDK or Legacy libraries when creating new project ?

Regards,
Filip.

Re: Unable to access stdio.h library

Posted: 08 Apr 2021 18:20
by Ladum
When creating the project I did the Microsdk library.

Re: Unable to access stdio.h library

Posted: 19 Oct 2021 02:34
by yongjun.reads
Hi,
I am new user of Necto Studio and am facing the same issue. I am working with STM32 MCU and USB UART Click and want to use sprintf (or similiar) function to form a string quickly (with float and decimal values) to be sent via UART. however #include <stdio.h> comes out empty.

similiar i am using microSDK library when i created the project.

Regards,
Yongjun

Re: Unable to access stdio.h library

Posted: 05 Mar 2022 16:18
by aminhusni
I am also having problems with sprintf in MikroSDK 2.0 in Necto (Clicker 4 STM32)

Re: Unable to access stdio.h library

Posted: 16 Mar 2022 17:34
by darko.ilijevski
Hello,

The stdio.h standard C library was not ported to the mikroE compilers because it mostly contains functions specific to CPU-driven OS architectures (such as file management and access functions). Therefore, only a few functions were ported as a standalone library. One of those is the sprintf() function. When working on a legacy project, the library is readily available from the library manager (after clicking the APPLY button). You can also include it in the memake file by simply adding MikroC.Sprintf inside the dependencies: {} and uses: {} nodes.

sprintf.jpg
sprintf.jpg (9.05 KiB) Viewed 1767 times

Unfortunately, these libraries have not been released for the mikroSDK2 yet.