You are not logged in.

#1 2020-09-29 12:45:25

W1F3B34T3R
Member
Registered: 2020-04-06
Posts: 7

math.h library in vscode on linux

I know that you have to use "-lm" tag on linux to include math.h lib but how do i do it in codeoss? I can manually do that but if i really wanted to do that why would i chose vscode in the first place. Here's the output

[Running] cd "/home/redacted/codeoss/" && gcc new.c -o new && "/home/redacted/codeoss/"new
/usr/bin/ld: /tmp/ccIxVWk8.o: in function `main':
new.c:(.text+0x2e): undefined reference to `sqrt'
collect2: error: ld returned 1 exit status

[Done] exited with code=1 in 0.081 seconds

, is there any way to change

 gcc new.c -o new

to

gcc new.c -o new -lm

in vscode?

Offline

#2 2020-09-29 12:51:03

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 10,026
Website

Re: math.h library in vscode on linux

Mod note:moving to Programming and Scripting


Sakura:-
Mobo: MSI X299 TOMAHAWK ARCTIC // Processor: Intel Core i7-7820X 3.6GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 5x 1TB HDD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#3 2020-10-13 16:49:12

dormammu_return
Member
Registered: 2020-10-13
Posts: 1

Re: math.h library in vscode on linux

If you are using vscode then install "Code Runner" from the extension menu and in that code runner settings you can set those commands to compile

Offline

Board footer

Powered by FluxBB