Partage
  • Partager sur Facebook
  • Partager sur Twitter

C codes not runnig on VS CODE

I can run my C codes on a workspace , but i can not run them as a sing

    24 janvier 2020 à 16:46:32

    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 .

    here's a screenshot for the error : https://i.stack.imgur.com/AaFjV.png .

    -
    Edité par NadjiBek 24 janvier 2020 à 18:31:52

    • Partager sur Facebook
    • Partager sur Twitter
      24 janvier 2020 à 16:54:21

      How do you compile ?

      What is the code ?

      • Partager sur Facebook
      • Partager sur Twitter
        24 janvier 2020 à 17:16:20

        Bonjour,

        Mauvais forum

        Le sujet est déplacé de la section Langage C vers la section Let's talk!

        • Partager sur Facebook
        • Partager sur Twitter
          24 janvier 2020 à 18:10:01

          r00tKiller a écrit:

          How do you compile ?

          What is the code ?


          i installed the "Code Runner" extensionfor VS Code

          any code even a hello world code won't work

          • Partager sur Facebook
          • Partager sur Twitter
            25 janvier 2020 à 5:03:58

            Hello,
            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.
            • Partager sur Facebook
            • Partager sur Twitter

            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.
            • Editeur
            • Markdown