0
votes

I'm trying to build and run a C++ source file with 2 header files in Codeblocks (Windows). I built a Codeblocks project to do so (this is the 1st time). I have also looked online for solutions on settings but I keep getting same message. This is the build log:

cannot find C:\Users\cs106: Permission denied collect2.exe: error: ld returned 1 exit status

search directories/compiler: "C:\MinGW\bin" search directories/linker: "C:\MinGW\bin" search directories/resource compiler: "C:\MinGW\bin"

I attach a picture of my project as well. In what field do I specify where to find this *.exe file?

enter image description here

enter image description here

My latest build log is the following:

-------------- Build: Debug in CS106v3.2 (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -LC:\MinGW\bin -LC:\MinGW\bin -o bin\Debug\CS106v3.exe obj\Debug\main.o "C:\Users\E\Documents\Algorithm\C++ S\cs106" C:\MinGW mingw32-g++.exe: error: C:\Users\E\Documents\Algorithm\C++ S\cs106: No such file or directory Process terminated with status 1 (0 minute(s), 0 second(s)) 1 error(s), 0 warning(s) (0 minute(s), 0 second(s))

Yet I do not refer anywhere to "C:\Users\E\Documents\Algorithm\C++ S\cs106". Why is it looking in that folder?

3
How about reading the log before what you show in your screenshot? - rubenvb
Log (red, line before collect2.exe error): c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find C:\Users\C++Lib\cs106: Permission denied c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find C:\Users\C++Lib\cs106: Permission denied - user1739581
And before that? Just copy paste the whole log in your question. Does C:\Users\C++Lib\cs106 even exist? Does the path contain spaces? - rubenvb
I have no more spaces in paths of project/build options. - user1739581
I have no more spaces in paths of project/build options. This is the next error message in build log: mingw32-g++.exe -Wall -fexceptions -g -IC:\MinGW\bin -IC:\MinGW\bin -c "C:\Users\E\Documents\Project CodeBlocks\CS106v3\main.cpp" -o obj\Debug\main.o mingw32-g++.exe -LC:\MinGW\bin -LC:\MinGW\bin -o bin\Debug\CS106v3.exe obj\Debug\main.o "C:\Users\E\Documents\Algorithm\cs106" C:\MinGW\include\cs106_full_cpp_library mingw32-g++.exe: error: C:\Users\E\Documents\C++Lib\cs106: No such file or directory Process terminated with status 1 (0 minute(s), 0 second(s)) 1 error(s), 0 warning(s) - user1739581

3 Answers

2
votes

This error message "Permission denied" collect2.exe is because the codeblocks console application is still running in the background. On windows 8: right click on the menu bar at the bottom of your screen. Then click "Task Manager" Under Processes. Locate on the the processed named "Console window Host" Right click on it and click "End Task" Click in the check box "Abandon unsaved data and shut down" Then click on "Shutdown" You should be good after that.

1
votes

Look in the process manager, your "CS106v3.exe" maybe still running there (mine was "study.exe", by the name of a project). You have to kill it. Sorry for such a silly answer, this happened to me because of an error in the code i was writing. I'm new to c++, happens to me everytime.

0
votes

This error message:

"Permission denied" collect2.exeerror: ld returned 1 exit status

…is because the application is still running in the background.

On Windows 10: right-click on the menu bar at the bottom of your screen. Then click on "Task Manager". Under the "Processes" tab in Task Manager, click on the current code file causing the error then click on "End task." Also, click on the application that you were using and click on end task. Close the task manager, open your application again and run your correct code again.

It should work now as it worked for me without restarting the PC.