I just installed Code::Blocks and Mingw32 gcc on my new computer after my old computer crached.
I started working on a new project, did some coding and tried to compile. I got error messages, so several times I made corrections and tried again.
At a certain moment I got no more error messages but the message "Execution of 'mingw32-g++.exe -Wall -fexceptions -g -c C:\Users...\priemzeef' failed"
From that moment I get only that message, also when I try to recompile older projects that used to compile fine on my old computer.
This is the build log:
-------------- Build: Debug in priemzeef (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -Wall -fexceptions -g -c C:\Users\wobie\Documents\Codeblocks\recreatie\priemzeef\main.cpp -o obj\Debug\main.o
Execution of 'mingw32-g++.exe -Wall -fexceptions -g -c C:\Users\wobie\Documents\Codeblocks\recreatie\priemzeef\main.cpp -o obj\Debug\main.o' in 'C:\Users\wobie\Documents\Codeblocks\recreatie\priemzeef' failed.
Another problem: when I click "save everything" I get an error message (see attachment), and when I open Code::Blocks I have to reload the project I was working on.
Wobien
Try installing Code::Blocks NOT in "Program Files" or other system-crucial folders, windows is really paranoid when it comes to write permissions in those folders.
Thank you Commaster, that solved the "save everything" problem.
But I still have the compiling problem. My project is a console application, and when I started it (that was on my new computer) I could compile the "hello World" program you get when you start a console application. This morning I tried to repeat that: I started a new console application and tried to compile the code I recieved:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello world!" << endl;
return 0;
}
The build log is:
-------------- Build: Debug in test (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -Wall -fexceptions -g -c C:\Users\wobie\Documents\Codeblocks\test\main.cpp -o obj\Debug\main.o
Execution of 'mingw32-g++.exe -Wall -fexceptions -g -c C:\Users\wobie\Documents\Codeblocks\test\main.cpp -o obj\Debug\main.o' in 'C:\Users\wobie\Documents\Codeblocks\test' failed.
That means that something has changed since I started my project, 2 days ago. What could that be?? As far as I know I didn't change anything.
Anti Virus? Modern Anti virus think that compiler are viruses and block them from creating executables
Did you restarted the PC?
Did it worked with the current setup sometime?
Thank you for your remarks BlueHazzard,
I swiched off my antivirus and tried to compile, but that didn't help.
I restarted the PC several times, but no compiling.
I don't understand your last remark.
QuoteI don't understand your last remark.
Have you changed something since the last time it worked? Did it never worked, or did it worked one time and then never again?
Hi BlueHazzard,
Working on my new project, I compiled succesfully several times. When I recieved the message:
Execution of 'mingw32-g++.exe -Wall -fexceptions -g -c C:\Users\wobie\Documents\Codeblocks\recreatie\priemzeef\main.cpp -o obj\Debug\main.o' in 'C:\Users\wobie\Documents\Codeblocks\recreatie\priemzeef' failed.
for the first time I had not changed anything.
After Commaster 's mail I deinstalled Code::Blocks and reinstalled it in C::\.
Go into Settings->Compiler->Tool chain executables->Auto-detedt
If this throws an error, press the "..." and brows to your compiler installation...
Hi BlueHazzard
I attached the message I get when I do that.
Now I opened the Toolchain executables I see something else: underneath the compiler directory I see:
NOTE: All programs must exist either in the "bin" sub-directory of this path, or in any of the "Additional paths".
I clicked Additional paths and found an empty window. Is that OK?
Quote
I attached the message I get when I do that.
This seems to be OK... And it still does not work?
Try Build->Rebuild and post again the Log from the "Build Log" tab
@devs: We need more output for this kind of error... For example the full path to the compiler executable, probably an output of "gcc" -v and probably some more resolving why the execution failed.
Quote@devs: We need more output for this kind of error... For example the full path to the compiler executable, probably an output of "gcc" -v and probably some more resolving why the execution failed.
And some info about the OS and CB version
This is the Build Log after Rebuild:
-------------- Clean: Debug in priemzeef (compiler: GNU GCC Compiler)---------------
Cleaned "priemzeef - Debug"
-------------- Build: Debug in priemzeef (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -Wall -fexceptions -g -c C:\Users\wobie\Documents\Codeblocks\recreatie\priemzeef\main.cpp -o obj\Debug\main.o
Execution of 'mingw32-g++.exe -Wall -fexceptions -g -c C:\Users\wobie\Documents\Codeblocks\recreatie\priemzeef\main.cpp -o obj\Debug\main.o' in 'C:\Users\wobie\Documents\Codeblocks\recreatie\priemzeef' failed.
The path to mingw is C:\MinGW
I attached the About window from CB
My OS is Windows 10
The last Windows 10 update adds optional protection to folders under Documents, so untrusted programs can't modify files inside those folders; Did you activate this option in Windows Defender?.
Copy the project folder outside of Documents (p.e. C:\CBProjects) and try to compile the copy.
If this does not work try opening a cmd console where main.cpp resides and execute
mingw32-g++.exe -Wall -fexceptions -g -c main.cpp -o main.o
Post the output of the command here.
I copied the project folder outside of documents and tried to compile. No succes.
I attached the output of the cmd console.
I also attached the mingw/bin directory: there is no file mingw32-g++.exe, but a file mingw32-gcc.exe
OK, in the CMD type this in this order:
set PATH=%PATH%;c:\MinGW\bin
and then
mingw32-g++.exe -Wall -fexceptions -g -c main.cpp -o main.o
The first command will add the MinGW compiler directory to your path so cmd can find the compiler command. The second command will try to build your source without codeblocks, so we can see if something is blocking the compiler.
[Edit:] as soon as you close the cmd you will have to retype the first command.
Still no succes... (see attachment)
There is no file mingw32-g++.exe in the directory c:\MinGW\bin. See my second attachement in my post at 07:17:49 pm
Try
mingw32-gcc.exe -Wall -fexceptions -g -c main.cpp -o main.o
Now Mingw reacts, but still no succes...
It seems G++ is not installed (is an option). Try
mingw-get update
and then
mingw-get install g++
After this the original command (with mingw32-g++.exe) should work. Probably the compiler executables must be configured again in CB.
Yes, it compiles!
Miguel Gimenez and BlueHazzard, many thanks!
The only thing I don't understand is how it is possible that it compiled when I started the project???
Do you have two MinGW installations?. Probably there was one prior installation of MinGW bundled with Code::Blocks (under Program Files) that was working, and later the automatic detection found the c:\mingw one (as it is the expected path for MinGW).
Where would that Mingw installation bundled with Code::Blocks be? In a subdirectory of the Code::Blocks directory in Program Files?
IIRC it was installed under Program Files\Codeblocks, but I have not installed the bundled version in years.
I don't think I have two MinGW installations. In the Directory where Code::Blocks is installed I can't find anything that looks like MinGW.