简体   繁体   中英

Codeblocks, C++ build: Permission denied collect2.exe

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?

在此处输入图片说明

在此处输入图片说明

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?

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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM