Page 1 of 1
How do you add the stdio.h library to a project ?
Posted: Tue Jan 05, 2021 9:30 am
by DutchOrange
So Iam busy with the Mwifi project and want to use printf(); for some testing, But how do you add the stdio.h library to the code ?
When I try use printf(); I just get an error in the build.
Is there an alternative ?
Windows 10 ESP-IDF/MDF 4.1
Re: How do you add the stdio.h library to a project ?
Posted: Tue Jan 05, 2021 1:47 pm
by ESP_Minatel
Hi,
Can you share the error you got?
Re: How do you add the stdio.h library to a project ?
Posted: Tue Jan 05, 2021 2:06 pm
by DutchOrange
Thanks for the reply.
The error is: I put what I think is necessary but I also have the .txt file with the rest of the error code.
Code: Select all
les/__idf_main.dir/no_router_example.c.obj -c ../main/no_router_example.c
../main/no_router_example.c: In function 'app_main':
../main/no_router_example.c:280:2: error: expected declaration specifiers before 'printf'
printf("Hello, This is to test the printf() \n"); //Adding to test printf();
^~~~~~
[915/956] Building C object esp-idf/mdebug/CMakeFiles/__idf_mdebug.dir/mdebug_cmd.c.obj
ninja: build stopped: subcommand failed.
ninja failed with exit code 1
Re: How do you add the stdio.h library to a project ?
Posted: Tue Jan 05, 2021 2:43 pm
by ESP_Minatel
Hi,
Could you share your code, or part of it? I think you may have an error before your printf function call.
Re: How do you add the stdio.h library to a project ?
Posted: Tue Jan 05, 2021 7:17 pm
by DutchOrange
Hey, So here is the code. It is the Mwifi example, I will upload as TXT and .c
Re: How do you add the stdio.h library to a project ?
Posted: Tue Jan 05, 2021 8:15 pm
by ESP_Minatel
Hi,
You need to change from:
Code: Select all
void app_main()
printf("Hello, This is to test the printf() \n"); //Adding to test printf();
{
to
Code: Select all
void app_main()
{
printf("Hello, This is to test the printf() \n"); //Adding to test printf();
Probably this is the issue.
Re: How do you add the stdio.h library to a project ?
Posted: Wed Jan 06, 2021 6:48 am
by DutchOrange
Thanks SO much, I cant believe I missed such a small thing with the brackets.