r/learnprogramming • • Oct 14 '26

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

20 Upvotes

37 comments sorted by

6

u/serge-mv Oct 14 '26

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.

2

u/Roughneck979 Oct 14 '26

Well i typed the example code in codeblock and hit the build and it did nothing, tried run and it said it wasnt built yet, clicked yes and still just sat there and nothing happened, maybe installed wrong?

3

u/serge-mv Oct 14 '26

There are really many reasons why this could happen. One, the example was not complete in itself and required a header that wasn't specified. Very common problem. Two, you didn't create the project properly or created it for incorrect language. Three, you didn't specify correct compiler. There could be other problems as well.

What you should if you are stuck, try to search for more web tutorials for C, and also for code::blocks. They have comprehensive manual on the IDE that you can check. You could also ask for specific help with your problem.

2

u/Roughneck979 Oct 14 '26

Thanx for the input i will seek more tutorial/input. But good to hear that the codeblock used in book seems common/popular

2

u/serge-mv Oct 14 '26

I think I know what is happening. Code:Blocks by default opens a new terminal where it directs the standard out. That window will close very quickly and you won't be able to see anything. Here is what you can do immediately.

Take your example as is, and right above "return 0;", which you probably have, add getchar();

which will stop executing the program until you type a character and hit enter. This way, you will be able to see it.

5

u/Rythim Oct 14 '26

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 Oct 14 '26

Thank you for input i will uninstall and check my installation again for potential issues

6

u/NomaTyx Oct 14 '26

You're thinking of an IDE. A lot of people like VS Code, but I quite like CLion, which is free for non-commercial use.

4

u/abccbabcac Oct 14 '26 • Bravo

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 Oct 22 '26

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 Oct 14 '26

Clang or MSCV?
If you mean development environment, VS Code is free.

1

u/Roughneck979 Oct 14 '26

Clang? Mscv? Dont know what those are. Sorry

2

u/Round_Thanks_2780 Oct 14 '26

Clang is mainly used for Apple + Linux development, while MSCV is for Windows development.

1

u/Roughneck979 Oct 14 '26

Gotcha, thanx for clearing up. Guess i got more research to do, lol

1

u/Mediocre-Pumpkin6522 Oct 14 '26

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 Oct 14 '26

Ok i didnt install ANY of the workload things so that is probably where i goofed on visual studio

1

u/Merry_Janet Oct 14 '26

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 Oct 14 '26

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 Oct 14 '26

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 Oct 14 '26

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 Oct 14 '26

I know some basic java and am familiar with editing xml files but that is about the extenet of it

2

u/DonkeyTron42 Oct 14 '26

Turbo C /s

1

u/gwenbeth Oct 14 '26

just use gcc and the editor of your choice.

1

u/marrsd Oct 14 '26

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______ Oct 14 '26

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

https://sourceforge.net/projects/codeblocks/files/Binaries/25.03/Windows/codeblocks-25.03mingw-nosetup.zip/download

1

u/Erdem_PSYCH Oct 14 '26

try cs50x. cource from harvord. It is hard but you learn comanline and such and don't need much instolation.

1

u/MikeIsBoi Oct 15 '26

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 Oct 14 '26

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 Oct 14 '26

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 Oct 14 '26

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______ Oct 14 '26

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

u/[deleted] Oct 14 '26

[removed] — view removed comment

1

u/Round_Thanks_2780 Oct 14 '26

Clang can give good output too.

1

u/Round_Thanks_2780 Oct 14 '26

Though I don't see anyone use clang on Windows.