Im having a littel probleme , wish to find some help here, my problems appear when i try to run a single .c file , it shows me the error :
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o : Dans la fonction « _start » : (.text+0x20) : référence indéfinie vers « main » collect2: error: ld returned 1 exit status
[Done] exited with code=1 in 0.13 seconds
i can run my codes if i put them inside a workspace and then build the task (CTRL + SHIFT + B) , but i need code some single files , so why i can't run them as a single file ? I really need to find the solution . Help please , Thanks .
You write your text in english but it seems that you use a french compiler ...
The file Scrt1.o was compiled with the -c option, am I right?
This code is probably a single function, not a complete program with a main().
Do you recognize the '_start' function name?
The error returned by ld is precisely because it can't give the control to the main function.
"collect2: error: ld returned 1 exit status" is the well known message.
I don't use VS code but I assume that it provides the main for you.
Le Tout est souvent plus grand que la somme de ses parties.
C codes not runnig on VS CODE
× Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
× Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
Le Tout est souvent plus grand que la somme de ses parties.