Author Topic: Code Blocks does not compile  (Read 1806 times)

Offline Schragner

  • Single posting newcomer
  • *
  • Posts: 7
Code Blocks does not compile
« on: March 17, 2021, 02:32:13 pm »
Why is my Code Block not able to build anything? I am using version 16.01 and I have windows 7. Whenever I try to build something it says "1 errors" and if I go to Building Log it says "mingw32-g++.exe: error: CreateProcess: No such file or directory". What should I do? I need it to work as soon as possible. Thanks very much!


Offline Schragner

  • Single posting newcomer
  • *
  • Posts: 7
Re: Code Blocks does not compile
« Reply #2 on: March 17, 2021, 06:47:24 pm »
I am running version 16.01 on windows 7. The compiler is GNU GCC Compiler.
When I write anything and hit build it says there is one error.
Build Log:
-------------- Build: Debug in 168 (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -fexceptions -g  -c "C:\Users\Administrator\Documents\New folder\168\main.cpp" -o obj\Debug\main.o
mingw32-g++.exe: error: CreateProcess: 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))
 
I have already tried reinstalling, restarting the computer, etc. but nothing works.
Thanks to anyone who helps me(including Miguel Gimenez)

Offline Miguel Gimenez

  • Lives here!
  • ****
  • Posts: 768

Offline Schragner

  • Single posting newcomer
  • *
  • Posts: 7
Re: Code Blocks does not compile
« Reply #4 on: March 17, 2021, 07:21:07 pm »
Thanks Miguel Gimenez for the responses, but I still can't get it to work. Anyone else please help if you can.

Offline Miguel Gimenez

  • Lives here!
  • ****
  • Posts: 768
Re: Code Blocks does not compile
« Reply #5 on: March 17, 2021, 07:39:08 pm »
Do you have two compilers installed, say one in C:\mingw and other under C::B installation folder?
Can you post the value of the path variable (open a console, write "path" without the quotes and press enter).
Can you take a snapshot of the compiler configuration in Settings -> Compiler -> Toolchain executables

Offline Schragner

  • Single posting newcomer
  • *
  • Posts: 7
Re: Code Blocks does not compile
« Reply #6 on: March 18, 2021, 07:46:13 am »
I only have one compiler, the standard one.
I  don't know where to put "path", because I have only used C::B for a specific reason.

Offline Miguel Gimenez

  • Lives here!
  • ****
  • Posts: 768
Re: Code Blocks does not compile
« Reply #7 on: March 18, 2021, 09:10:42 am »
Consoles are from Windows, and they can be opened using Windows key + R and writing "cmd"

You can try changing the mingw32.. file names in "Toolchain executables" (using the button with three dots) to just gcc.exe and g++.exe.

If this does not work, uninstall C::B and the compiler and install 20.03.

Offline Schragner

  • Single posting newcomer
  • *
  • Posts: 7
Re: Code Blocks does not compile
« Reply #8 on: March 18, 2021, 09:31:38 am »
I have tried changing the file names to both of those, yet it still doesn't work. I am hopeless that anything will work. I need specifically the 16.01 version, and I don't know what to do. I have even considered buying a new laptop.

Offline gd_on

  • Lives here!
  • ****
  • Posts: 660
Re: Code Blocks does not compile
« Reply #9 on: March 18, 2021, 10:17:16 am »
Three things to try :
  • I know that with some old versions of gcc tools, there is a problem with spaces inside the path of a file. In  "C:\Users\Administrator\Documents\New folder\168\main.cpp" there is a space between "New" and "folder". Generally, when using MinGW, avoid spaces in the path names. There are still some old utilities in MinGW set of tools which don't like spaces.
  • In your path variable, to be able to execute an exe file built with MinGW, you should add path like C:\OJI\codeblocks\MINGW\bin" (in your case). This path is necessary if you try to execute your .exe outside codeblocks : codeblocks adds this for its own usage (so when you use the Run icon for example). But if you use directly your exeutable in a console, it may need access to some dll inside ...MinGW\bin.
  • Your main.cpp path suggests that you are Administrator. If it's not the case, you have not the right priviledges. So move your code in an other place where you have the good rights

Buying a new laptop? It's up to you, but I really doubt that this is the problem !
« Last Edit: March 18, 2021, 10:29:14 am by gd_on »
Windows 10 64 bits (21H1), svn C::B (last version or almost!), wxWidgets 3.1.5, Msys2 Compilers 10.3.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (sjlj, posix in C:\msys64\mingw32).

Offline Miguel Gimenez

  • Lives here!
  • ****
  • Posts: 768
Re: Code Blocks does not compile
« Reply #10 on: March 18, 2021, 10:27:32 am »
You can install a new MinGW distro:
Nuwen (64 bit only) https://nuwen.net/mingw.html
MinGW-w64 https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/7.2.0/threads-posix/sjlj/
TDM https://jmeubank.github.io/tdm-gcc/download/

and configure the toolchain settings so they point to the new installation.

Offline Schragner

  • Single posting newcomer
  • *
  • Posts: 7
Re: Code Blocks does not compile
« Reply #11 on: March 18, 2021, 10:53:21 am »
I think I might install the newest version jut to get this over with because in the meantime I reinstalled it and another error occurred and I'm pretty much done mentally :/.

Offline Avan

  • Multiple posting newcomer
  • *
  • Posts: 24
Re: Code Blocks does not compile
« Reply #12 on: March 18, 2021, 01:03:37 pm »
... the meantime I reinstalled it and another error occurred and I'm pretty much done mentally :/.

Schragner,

Yes, projects like CB can be (read: are) daunting. Try this document, unlike most other doc's it's quite recent and helped me onderstand the installation process better and allowed to iron out a lot of wrinkles.

http://www.codeblocks.org/docs/manual_codeblocks_en.pdf

Also, try to use one of the most recent CB versions as the team has had to implement High DPI Awareness and 'a lot went wrong' during that process.

Offline Schragner

  • Single posting newcomer
  • *
  • Posts: 7
Re: Code Blocks does not compile
« Reply #13 on: March 18, 2021, 01:17:49 pm »
Thanks to everyone who helped or tried to help me, I am grateful to you all. But I managed to solve the problem in a more "basic" way, by just changing the laptops user and downloading it again. Again, thank you so much to everyone, and for being so understanding with me, 'cause this is my first time posting something in any forum! Bye now!