Skip to content
Sign upLog in
Profile icon

Neil Staley

@18staleyn
Repls
Community
18staleyn
18staleyn
shared a Post
3 years ago
1
Issues with math.h library in C ***FIXED***
Hello, I am relatively new to using C so I have absolutely no clue what in the world is going wrong with my code. In my programming class, we are usi
SamTheDev
SamTheDev
Or you can edit the Makefile, and simply add that -lm flag in line 2 I installed Nano and copied the flag to the Makefile, and it worked!5 months ago
abc3354
abc3354
Hi ! Like @BigMitchyT and @Nanashi said, it is a bug with compiler flags. However, there is a solution : Right click on the editor > Command Palette > type Open shell > Press enter In the shell which open, you can compile by hand Basically, type gcc main.c -lm -o main then ./main to run your code. Hope this will help ;) > Replit helper here ! > If you found my answer helpful, you can upvote it :)3 years ago
BigMintyMitch
BigMintyMitch
Based on my small knowledge of C/C++ and what I found on Google, you need to link the program to the Math library manually, because unlike or , does not automatically link to the program when it compiles. However as far as I am concerned, there is no way to pass that command into the compiler on Repl.it. (If there is I'm flat out missing it) Somebody else may know how to get it to work, but I do not see a way.3 years ago