#Getting Error implicit declaration of function 'printf' [-Wimplicit-function-declaration].

16 messages · Page 1 of 1 (latest)

stray pecan
#

here is my code, i have MinGC or whatever its called installed and added to path and i have the c/c++ microsofat vs code extention.

#include <stdio.h>

int main()
{
printf("Test");
return 0;
}
noble reefBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

hollow star
#

Are you sure you saved the file with the header include in it?

indigo vigil
#

You are better off using Visual studio.

keen island
#

your code is entirely correct; "Implicit declaration of function 'printf' " is basically just a way to say that it can't find that function. i can't tell you the exact answer, because i don't know how your environment is set up, but the issue is that the standard library (which has stdio.h) is not being linked with the program when it's compiled

#

... or it's some other weird issue

#

but that's my best guess?

ebon rune
#

Either this isn't the code you're compiling (you didn't save the file or are compiling a different file), or you edited stdio.h and messed something up in there

ebon rune
hollow star
#

The problem is setting up VSCode for projects as a beginner-- not the compiler here. Visual Studio would set it up properly

ebon rune
#

Having to learn to press ctrl+s is a difficulty curve, that's for sure 😛

hollow star
#

Getting VSCode's code runner to work can either be a quick 10 second copy paste or a half hour long or longer painstaking process

stray pecan
#

i used visual studio instead adn that worked

#

!solved