How to Fix Missing stdio.h Error in C on Visual Studio?

0
16
Asked By CuriousCoder42 On

Hi everyone! I'm trying to get started with learning C programming and I'm using Visual Studio since I already have it installed. I followed some online instructions and installed the necessary C++ packages. I created a new empty C++ project and then added a .c file to it. However, I'm stuck because I keep getting an error: "E1696 cannot open source file 'stdio.h'". Here's a snippet of my code:

#include

int main(void) {
printf("Standard C: %ld\n", __STDC_VERSION__);
return 0;
}

I've checked the installed C++ packages, and while my computer is in French, I made sure the package names were understandable in English. Any ideas on how to resolve this issue? Thanks for your help!

3 Answers

Answered By BookwormDev On

For a great learning resource, I still recommend the book "Microsoft Visual C# 2005 Express Edition: Build a Program Now!" which comes with a CD. You might want to check if your library has it!

SkepticalSam -

What does that even relate to in this context?

Answered By TechieTim123 On

It seems like your project setup might have some issues. Have you considered switching to CLion? It's a great IDE with full C support, unlike Visual Studio which is more C++ focused. When creating a project in CLion, choose 'C Executable' or the Meson build system, and make sure to set it to the latest language standard — it should work right out of the box!

FixItJim -

Thanks for the suggestion! I'll look into CLion. I actually found a workaround for Visual Studio by adjusting the project paths, but I'll keep your advice in mind for future projects.

Answered By DevDude88 On

Your Visual Studio install may not have set up properly since it usually works out of the box. If you're learning C, consider using MinGW. It's a simple installation and gives you a modern C toolkit as well as C++. Plus, the download size is smaller than Visual Studio! Here’s a link to a good guide on how to install it: [Installing C/C++ GNU Compilers on Windows Using MinGW](https://www.zeusedit.com/phpBB3/viewtopic.php?t=8428).

CuriousCoder42 -

Thanks for the heads up! I think there might have been something wrong with my Visual Studio setup, but I managed to patch it up by forcing some paths in the project settings.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.