Menu

Invalid argument ld returned 1 exit stat

Lelio83
2007-10-13
2012-09-26
1 2 > >> (Page 1 of 2)
  • Lelio83

    Lelio83 - 2007-10-13

    Hello everyone. I have a problem with dev c++ since i formatted my computer. I can't resolve it even if i delete dev c++ an reinstall it. My problem is that when I compile a source code for the first time everything goes ok but when i try to recompile it for a second time i get this message: " Invalid argument ld returned 1 exit status". I think that this fact is strictly connected to the fact that i'm not able to delete the .exe created by the compiler until i reboot my computer (even if the dev c++ is closed). As a matter of fact i think that the compiler gives me this error because is not able to overwrite the paste .exe created. Can you solve my problem? Thank you in advance.

     
    • Lelio83

      Lelio83 - 2007-10-17

      Thank you. Ok,as I thought this was the problem. The system("pause") made the console not to release the program execution. But if I want to mantain the program's result on the screen, how I have to do? I tried using a getchar() at the end of the program but it caused
      the same error as the system("pause"). How I have to do now? Thank you in advance.

       
    • cp

      cp - 2007-10-18

      This is a stange problem. I tried your code on a machine with
      italian Windows XP Pro and it compiles and runs multiple times.

      Maybe it depends on some uncommon os settings, combined
      with your non standard coding practice: main() should return
      an int and you have to write
      int main()
      instead of
      main()
      and to add a return statement.

      If you add -Wall to your compiler options in
      Tools->compiler options->Add the following commands ...
      (always a good idea!)
      you get 2 warnings, as you can see in this eample log:

      Compiler: C compiler
      Executing gcc.exe...
      gcc.exe "C:\prova.c" -o "C:\prova.exe" -Wall -I"C:\Programmi\Dev-Cpp\include" -L"C:\Programmi\Dev-Cpp\lib"
      C:\prova.c:3: warning: return type defaults to 'int'
      C:\prova.c: In function 'main':
      C:\prova.c:6: warning: control reaches end of non-void function

      Execution terminated
      Compilation successful

      The first warns that GCC fixes your main() to int main()
      whereas other compilers may give you an error instead.

      Try to fix your code and retry.

      cp

      Italian translation:

      E` un problema strano. Ho provato il tuo codice su una
      macchina con Windows XP Pro in italiano e non ho avuto
      avuto i tuoi problemi.

      Forse dipende da qualche impostazione di sistema poco
      comune che interagisce con il tuo codice non standard:
      main() deve restituire un int e devi scrivere
      int main()
      al posto di
      main()
      and inserire un'istruzione return.

      Se aggiungi -Wall alle opzioni di complilazione
      Tools->compiler options->Add the following commands ...
      (sempre una buona idea!)
      ottieni due warning, come puoi vedere in questo log
      di esempio:

      Compiler: C compiler
      Executing gcc.exe...
      gcc.exe "C:\prova.c" -o "C:\prova.exe" -Wall -I"C:\Programmi\Dev-Cpp\include" -L"C:\Programmi\Dev-Cpp\lib"
      C:\prova.c:3: warning: return type defaults to 'int'
      C:\prova.c: In function 'main':
      C:\prova.c:6: warning: control reaches end of non-void function

      Execution terminated
      Compilation successful

      Il primo ti avverte che GCC corregge main() in int main()
      mentre altri compilatori potrebbero dare invece un errore.

      Prova a correggere e riprovare.

      cp

       
    • Lelio83

      Lelio83 - 2007-10-18

      Nothing to do. I put int main() and at the end of the program return 0; but still persists the problem both with system("pause") and getchar(). I'm turning crazy. First than I formatted it did not give this problem.

       
    • Lelio83

      Lelio83 - 2007-10-18

      But now the compile log is this:

      Compilatore: Default compiler
      Esecuzione di gcc.exe...
      gcc.exe "C:\Dev-Cpp\Projects\prova.c" -o "C:\Dev-Cpp\Projects\prova.exe" -Wall -g3 -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib" -g3
      C:\Dev-Cpp\Bin..\lib\gcc\mingw32\3.4.2........\mingw32\bin\ld.exe: cannot open output file C:\Dev-Cpp\Projects\prova.exe: Permission denied
      collect2: ld returned 1 exit status

      Esecuzione terminata

      Now it gives this error:Permission denied.

       
    • Lelio83

      Lelio83 - 2007-10-18

      Hi,yes I give there the character and leave the program closing after this. I know that I can launch the program from a console but i don't want to do this beacause I use an IDE just because I want that with a button I can compile and launch the program although I'd used the compiler directly in shell and I'd write the programs in the notepad. I hope to find a different solution like to restore the
      windows's configuration that made dev c++ work properly first than I formatted.

       
      • cp

        cp - 2007-10-19

        I'm curious: why did you format your HD? Did you changed the
        file system to an unusual one?

        cp

         
    • Lelio83

      Lelio83 - 2007-10-20

      No,I used FAT32 as ever.

       
    • Wayne Keen

      Wayne Keen - 2007-10-13

      Please take a moment and post your "Basic 3" for an example that shows the effect.
      The Basic 3 are covered in the thread titled "Please Read Before Posting a Question"

      Wayne

       
    • Anonymous

      Anonymous - 2007-10-13

      You cannot delete an executable or rebuild it if the executable is still running. Make sure you close running instances of your program before rebuilding. Check the Task Manager process list (ctrl-alt-del) to make sure the process is not running 'invisibly'.

       
    • Lelio83

      Lelio83 - 2007-10-13

      As a matter of fact I think that ms-dos prompt still executes even if i close the ms-dos window and the execution seems stopped. How can I see invisible processes in the task manager in windows xp? It does not appear in the task manager ad process in execution. Thanks.

       
      • Wayne Keen

        Wayne Keen - 2007-10-13

        Your Basic 3?

        I did not ask just to be asking.

        For completeness, there is no such thing as MS-DOS window in XP, it is a console window. :)

        Wayne

         
    • Lelio83

      Lelio83 - 2007-10-13

      Hi, what's my basic 3? I red the topic but i'm not understanding.

       
    • Anonymous

      Anonymous - 2007-10-13

      >> How can I see invisible processes in the task manager in windows xp?
      Uh.... press ctrl-alt-delete like I said!

      Basic 3: It is the first link in the thread you said you'd read: http://sourceforge.net/forum/forum.php?thread_id=1035429&forum_id=48211
      1) Dev-C++ version.
      2) Compile log - all of it.
      3) Example code reproducing the problem

      IMO the compile log is the most important of these, and in this case the code is probably not important, but since many of this asking for help are not able to determine what is relevant, you should post it all. If you do this in teh forst post rathet than waiting to be asked, most problems are solved very quickly.

       
    • Lelio83

      Lelio83 - 2007-10-13

      Oh sorry. My Basic 3 is:

      1) dev c++ version 4.9.9.2

      2) My compile log is:

      Compilatore: Default compiler
      Esecuzione di gcc.exe...
      gcc.exe "C:\Documents and Settings\Lelio\Desktop\prova.c" -o "C:\Documents and Settings\Lelio\Desktop\prova.exe" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"
      C:\Dev-Cpp\Bin..\lib\gcc\mingw32\3.4.2........\mingw32\bin\ld.exe: cannot open output file C:\Documents and Settings\Lelio\Desktop\prova.exe: Invalid argument
      collect2: ld returned 1 exit status

      Esecuzione terminata

      3) The code (but the problem persists with all codes i use) is:

      include<stdio.h>

      include<stdlib.h>

      main() {
      printf("Hello World");
      system("PAUSE");
      }

       
      • Osito

        Osito - 2007-10-13

        It might be the spaces in the filename.

         
    • Lelio83

      Lelio83 - 2007-10-13

      There aren't spaces in the filename.

       
      • Osito

        Osito - 2007-10-13

        You're telling me you don't see any spaces in this:

        "C:\Documents and Settings\Lelio\Desktop\prova.exe"

         
    • Lelio83

      Lelio83 - 2007-10-13

      I forgot to say that when I try to delete .exe my OS says: can't delete prova:Access denied. Check if the disk is full or write protected or the file is actually in use.

       
    • Lelio83

      Lelio83 - 2007-10-13

      It's not this the problem. There ae spaces in the path not in the filename.

       
      • Osito

        Osito - 2007-10-13

        Fine, be difficult. Let me try again:

        It might be the spaces in the PATH.

        When I said filename I meant the full filename including path. I apologize for not using the proper term. I thought the meaning was pretty clear, but apparently not.

         
    • Anonymous

      Anonymous - 2007-10-13

      Putting your projects on the Desktop is a really bad idea for lots of reason - the compiler will dump all its intermediate files there also. Bit besides that it is in "Documents and Settings\&lt;username>", which contains spaces. The thread you were directed to read in the very first response warns about using such paths! So you did not really read it, did you? I appreciate however that it is not in your native language however.

      Move your project. It may not fix the fault, but no one is going to consider the problem further until you do, and you have posted a new log, because if this is the problem, we would be wasting out time.

      Clifford

       
    • Lelio83

      Lelio83 - 2007-10-14

      Hi Clifford thank you. Yes as you can see i'm italian and for me it's quite difficult to speak and to read english. I red that tread and i'v done a try putting my project in the root of my pc (simply c:) but nothing is changed. It gives me the same error and the log is the same as that i posted considering c:\ as path rather than C:\Documents and Settings\Lelio\Desktop\ obviously. Previously dev c++ never gave me errors. It gives me this error since I reinstalled my windows xp home edition.

       
      • Wayne Keen

        Wayne Keen - 2007-10-14

        It is always best when doing this kind of remote debugging, to provide the direct data,
        rather than your interpretation of it.

        If you are asked to change something, you should repost your log, rather than just
        providing us with a statement about getting "the same error". This sort of methodical
        step by step analysis, while it may annoy some because it is not a "magic word" instant
        solution that they would prefer, is in fact quite important.

        Wayne

         
        • Wayne Keen

          Wayne Keen - 2007-10-14

          Note also that doing a clean uninstall and reinstall is more involved that simply
          running the uninstaller - there is a section in the "Please Read" thread on how to
          do it.

          Wayne

           
1 2 > >> (Page 1 of 2)

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.