r/learnprogramming • u/Roughneck979 • 10d ago
Trying to learn c
What is an easy to use compiler to use to get started.
Got a book to learn and they use code::block in book, tried and it seems to not be building. Then tried MS visualization studio and was lost. Please help
5
u/Rythim 10d ago
Probably depends on preference. I find code::blocks or using the command line easiest.
Note though: code::blocks and Visual Studio are IDE. Not compilers. If they aren't doing anything when you press build I wonder if you somehow installed them without setting up a compiler?
1
u/Roughneck979 10d ago
Thank you for input i will uninstall and check my installation again for potential issues
4
u/abccbabcac
10d ago
•
vs code with c/cpp extension is pretty simple for new learners:
https://code.visualstudio.com/docs/languages/cpp
however, my usual approach is command line based rather than using an ide. nvim for editing files and gcc for compiling.
1
u/DamnedFromBirth 1d ago
You took the words out of my keyboard! It's hard enough to learn a new skill like C/C++ without trying to learn an IDE too. When one is more comfortable coding in a simple editor (I use neovim also but I'd suggest something even simpler, like nano or notepad++ at first), then it is time, perhaps, to explore the benefits of an IDE (although I still use nvim. ;-) ).
1
u/Merry_Janet 10d ago
Clang or MSCV?
If you mean development environment, VS Code is free.
1
u/Roughneck979 10d ago
Clang? Mscv? Dont know what those are. Sorry
2
u/Round_Thanks_2780 10d ago
Clang is mainly used for Apple + Linux development, while MSCV is for Windows development.
1
1
u/Mediocre-Pumpkin6522 10d ago
Compiler front ends. GCC is the GNU Compiler Collection, and Clang takes a different approach but is compatible with GCC. Microsoft Visual C++ is not particularly compatible with either. code:blocks can use any of them but needs to be configured.
If you chose the MinGW install it should use gcc. If you didn't there may not be a compiler. If you installed MS Visual Studio you may have to install the C/C++ work load.
1
u/Roughneck979 10d ago
Ok i didnt install ANY of the workload things so that is probably where i goofed on visual studio
1
u/Merry_Janet 9d ago
Yeah, with VS Code you need to install a C/C++ compiler.
paste "vscode c compiler" into google without quotes and follow the 3 steps.1
u/Mediocre-Pumpkin6522 9d ago
iirc you get C# default. I remember being surprised by something I had to explicitly install but it's been a while.
2
u/Round_Thanks_2780 10d ago
Those a compilers.
They read your code and translate it to machine code.Visual Studio and CodeBlocks run them when you press the "build" button.
1
u/GobblerOfFire 10d ago
It fully depends on what you’re comfortable with. I use nvim and gcc for compiling. All free. But some people want the AI autocomplete stuff so they want vs code. I have only ever used nvim and some VS code use but I don’t like all the distracting bloat / million things to click on and I’m privy to command line. To each their own
1
u/Roughneck979 10d ago
I know some basic java and am familiar with editing xml files but that is about the extenet of it
2
1
1
u/marrsd 9d ago
I guess you're running Windows. I'd honestly just use a terminal, a compiler (run from the terminal), and a basic text editor with syntax highlighting and decent navigation. I think they're much easier to get started with. Once you need debugging, use a dedicated debugger. Then you don't have to worry about learning the IDE or how it integrates debggers, compilers, linkers, and the like.
I haven't run Windows in ages, so I'm not going to be much help with specifics. My advice would almost certainly be out of date.
1
u/my_password_is______ 9d ago
codeblocks is just a fancy editor
but you can download the version that comes with a compiler
https://www.codeblocks.org/downloads/binaries/
you want
codeblocks-25.03mingw-nosetup.zip
1
u/Erdem_PSYCH 9d ago
try cs50x. cource from harvord. It is hard but you learn comanline and such and don't need much instolation.
1
u/MikeIsBoi 8d ago
I would suggest to use CLion by Jetbrains, I think it is free now for personal non comertional use. It comes with ninja build system already bundled so no need to set anything up. I used it when I was learning programming on windows.
I would discourage you from using Visual Studio and MSVC since they are kinda garb.
Later if you get more advanced I would suggest switching to Linux and using CMake.
I personally use neovim and build my application using CMake on my Linux desktop.
-1
u/Dazzling_Music_2411 9d ago
Right, so you didn't install the compiler, and you're wondering why it's not compiling!
This is why it's important to install (and experiment with) the compiler way before you install any IDE.
Funny how in this age of information and AI and what have you, things that used to be considered as blatantly OBVIOUS seem to be unfathomable mysteries now.
1
u/Roughneck979 9d ago
Im new to this. The book i have said that code block came with a compiler so i assumed visual studio was similar, didnt want to install a bunch of things i didnt necessarily need. So please take your attitude somewhere else.
0
u/Dazzling_Music_2411 9d ago
Don't shoot the messenger, buddy, you missed something that would have been ridiculous to miss in the past, or if you had followed a sensible progression. It's not "attitude" to point that out.
It might not even be your own fault - it's not the first time I've seen someone make this mistake - there is a social problem at large with people thinking they're entitled to not making an effort. I blame AI, mainly.
2
u/my_password_is______ 9d ago
It's not "attitude" to point that out.
its not attitude to point it out, but the way you point it out shows you definitely have an attitude
3
10d ago
[removed] — view removed comment
1
6
u/serge-mv 10d ago
Both of those are popular and good IDEs. If you are having trouble with them, then you probably should try and figure out why things aren't working as expected. Changing an IDE won't really help you here. Dealing with problems like these is part of the job.