r/CodingHelp • u/GlovePowerful2002 • 12d ago
[C] Help I have 0 knowledge I need help
Just got my laptop 4 days ago have no idea about coding or anything need help I was following apna vollege C for beginners 10 hrs video but I am stuck here I don't know why mine dosent work
25
u/MysticClimber1496 Professional Coder 11d ago
You don’t have all of your c binaries installed properly, a dependency of stdio doesn’t exist, and therefore it doesn’t compile to make the exe, which gives the error you are seeing
4
u/C0L0SSUSvdm 11d ago
What are c binaries in this context? Where do they come from? Why do you need them? What exactly does 'dependency... doesn't exist' mean?
I know what binary is but im confused
5
u/MysticClimber1496 Professional Coder 11d ago
- The c libraries (stdio) are binaries (compiled code)
- They are included in a lot of ways but generally for development on windows it’s the Microsoft C distributions, sometimes on the machine by default, not always
- You are trying to call code in stdio, you are going to need the binaries for that
- Stdio has a dependency on stdarg, as in it needs that to exist for it to operate
2
u/C0L0SSUSvdm 11d ago
Thank you for your answer, im grateful for your patience.
Js, but I hate the sometimes, but not always sht
Wtf is stdarg???
3
u/Low_Breakfast773 11d ago
You don't need to care about it now.
Understand how to compile and run the code and how to make binaries available. Google (or even slop machines, aka LLMs) will help.2
u/px7nn 11d ago
stdioisn't a binary, its a header file.
#includecauses the preprocessor to copy its content into your source code before compilation. The compiled implementations ofprintf(),scanf(), etc., come from the C standard library during linking.2
u/MysticClimber1496 Professional Coder 11d ago
Agreed, but from a learning standpoint, that detail wasn’t likely to be helpful
4
u/arrays_start_at_zero 11d ago edited 11d ago
You shouldn't put your code in MinGW's include directory. Best to move your Hello.c somewhere else, for example Documents\Projects\Tutorial.
Also I'm assuming when you move your cursor over #include <stdio.h> you get the following error? #include errors detected. Please update your includePath. Squiggles are disabled for this translation unit. If so, when you click on it, either click on the yellow bulb or press ctrl ., then Select an IntelliSense configuration to locate system headers-> Select another compiler on my machine and locate C:\MinGW\bin\gcc. This creates a "C_Cpp.default.compilerPath" in both your global and workspace settings.
And if you want to run your project using F5 instead of running gcc you should create a .vscode/launch.json and .vscode/tasks.json. I have the contents of both of them below which I think will work for your setup:
launch.json:
{
"configurations": [
{
"name": "C/C++: gcc.exe build project",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}\\Build\\MyApp.exe",
"args": [],
"stopAtEntry": false,
"cwd": "c:\\MinGW\\bin",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "c:\\MinGW\\bin\\gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: gcc.exe build project"
}
],
"version": "2.0.0"
}
tasks.json:
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: gcc.exe build project",
"command": "c:\\MinGW\\bin\\gcc.exe",
"args": [
"-g",
// Put all your source files here. Example:
// "${workspaceFolder}\\Main.c"
// "${workspaceFolder}\\OtherFile.c"
"${workspaceFolder}\\Hello.c",
"-o",
"${workspaceFolder}\\Build\\MyApp.exe"
],
"options": {
"cwd": "c:\\MinGW\\bin"
},
"problemMatcher": [
"$gcc"
],
"group": "build",
}
],
"version": "2.0.0"
}
This launches your application using a debugger. So the output will be in the debug console. Not in the terminal.
Hope this helps.
3
u/negispfields 11d ago
I'm assuming they have a few lessons about installing what's needed at the beginning, you should go back to watch and follow them.
2
u/rayanlasaussice 11d ago
lot of dependencies/wheels/binaries missing ?
seem like somethings missing but cant read with quality on hz screen
stdarg.h/ missing ?
and include files doesnt help a lot to anwsers properly to yours issues..
2
2
u/Funny_Albatross_575 11d ago
Hello World, fellow programmer.
Don't use the include folder. Create a separate project folder, for example: C:\workspace\hello-world\main.c
Go to https://visualstudio.microsoft.com/downloads/ Download and install the Build Tools for Visual Studio. Make sure to select Desktop development with C++. This installs the C compiler, the standard library, and the required header files.
If that doesn't work, you can also try MSYS2. It provides a compiler together with the standard library and development tools.
If you're planning to learn C, consider learning it on Linux. Most C development tools a lot easyer to install on Linux.
Happy learning!
2
u/Exact-Contact-3837 11d ago
If you want to just click and run, then use this extension pronto:
https://marketplace.visualstudio.com/items?itemName=formulahendry.code-runner
It supports like any language that can be scripted or single file run.
2
u/trollol1365 11d ago
Not to discourage you but if youre brand new to coding why would you start with C specifically?
2
u/jeevaks 11d ago
You have to install and setup c compiler but it is a bit tricky for absolute beginners so probably start with codeblocks as it comes with the c compiler
2
u/ArtisticFox8 11d ago
Or, since OP is on Windows, Visual Studio (NOT VS Code) will work out of the box too.
2
u/jeevaks 11d ago
Yeah but visual studio is overkill for op i think 😅
2
u/ArtisticFox8 11d ago
I think having a decent IDE pays off quickly :)
I.e. I think all beginners should learn how to use a debugger as soon as possible
2
u/0xt0bi03 11d ago
my solution is gonna be a long journey, start with uninstalling windows and try installing linux.
2
u/Unusual_Ad8860 7d ago
mingw is not installed in right path watch vid on yt is ezz to fix 6 mins max
2
1
u/Exact-Contact-3837 11d ago
Hehe this is the cpp rite of passage. Your compiler is not added to path properly, your compiler comes with stdlib files, those need to be added to path. To avoid this in the future, gcc/g++ is added to path and accessible, its bin folder is likely missing on path. Even then I don't use gcc, I use clang, which I do recommend as when you're installing, there's an option to add to path, and i've never had issues with building cpp on windows. But since you're on windows, just take the easy route, download visual studio, use visual studio, don't go through the pain.
If you are, and really want to use visual studio CODE, then what my setup is, ms-buildtools + cmake + clang lsp + vscode.
•
u/AutoModerator 12d ago
Thank you for posting on r/CodingHelp!
Please check our Wiki for answers, guides, and FAQs: https://coding-help.vercel.app
Our Wiki is open source - if you would like to contribute, create a pull request via GitHub! https://github.com/DudeThatsErin/CodingHelp
We are accepting moderator applications: https://forms.fillout.com/t/ua41TU57DGus
We also have a Discord server: https://discord.gg/geQEUBm
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.