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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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'.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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\<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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
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.
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
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.
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.
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.
I'm curious: why did you format your HD? Did you changed the
file system to an unusual one?
cp
No,I used FAT32 as ever.
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
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'.
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.
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
Hi, what's my basic 3? I red the topic but i'm not understanding.
>> 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.
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");
}
It might be the spaces in the filename.
There aren't spaces in the filename.
You're telling me you don't see any spaces in this:
"C:\Documents and Settings\Lelio\Desktop\prova.exe"
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.
It's not this the problem. There ae spaces in the path not in the filename.
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.
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\<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
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.
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
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