Author Topic: cannot compile  (Read 8915 times)

Offline wobien

  • Multiple posting newcomer
  • *
  • Posts: 69
cannot compile
« on: September 10, 2018, 11:23:00 pm »
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

Offline Commaster

  • Almost regular
  • **
  • Posts: 171
Re: cannot compile
« Reply #1 on: September 11, 2018, 03:04:17 am »
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.

Offline wobien

  • Multiple posting newcomer
  • *
  • Posts: 69
Re: cannot compile
« Reply #2 on: September 11, 2018, 12:14:32 pm »
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.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: cannot compile
« Reply #3 on: September 11, 2018, 07:15:23 pm »
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?

Offline wobien

  • Multiple posting newcomer
  • *
  • Posts: 69
Re: cannot compile
« Reply #4 on: September 11, 2018, 08:51:03 pm »
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.


Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: cannot compile
« Reply #5 on: September 12, 2018, 01:14:27 am »
Quote
I 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?

Offline wobien

  • Multiple posting newcomer
  • *
  • Posts: 69
Re: cannot compile
« Reply #6 on: September 12, 2018, 09:14:18 am »
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::\.


Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: cannot compile
« Reply #7 on: September 12, 2018, 10:37:56 am »
Go into Settings->Compiler->Tool chain executables->Auto-detedt

If this throws an error, press the "..." and brows to your compiler installation...

Offline wobien

  • Multiple posting newcomer
  • *
  • Posts: 69
Re: cannot compile
« Reply #8 on: September 12, 2018, 10:58:55 am »
Hi BlueHazzard
I attached the message I get when I do that.

Offline wobien

  • Multiple posting newcomer
  • *
  • Posts: 69
Re: cannot compile
« Reply #9 on: September 12, 2018, 11:09:20 am »
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?

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: cannot compile
« Reply #10 on: September 12, 2018, 02:04:34 pm »
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.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: cannot compile
« Reply #11 on: September 12, 2018, 02:34:49 pm »
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

Offline wobien

  • Multiple posting newcomer
  • *
  • Posts: 69
Re: cannot compile
« Reply #12 on: September 12, 2018, 03:45:56 pm »
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


Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: cannot compile
« Reply #13 on: September 12, 2018, 04:24:32 pm »
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

Code
mingw32-g++.exe -Wall -fexceptions -g  -c main.cpp -o main.o

Post the output of the command here.
« Last Edit: September 12, 2018, 04:26:10 pm by Miguel Gimenez »

Offline wobien

  • Multiple posting newcomer
  • *
  • Posts: 69
Re: cannot compile
« Reply #14 on: September 12, 2018, 06:17:49 pm »
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