News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Wont Build C code

Started by Rich_P, January 25, 2013, 11:34:13 AM

Previous topic - Next topic

Rich_P

HI All,

Im a newbie on here and to C, im learning from a book and woujld like to use CodeBlocks to compile the simple programs outlined in the book,

I keep getting this error when trying to build

Execution of 'mingw32-g++.exe  -o C:\simple\Simple2.exe C:\simple\Simple2.o' in 'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\CodeBlocks' failed.

I hope someone can help

Rich

BlueHazzard

Hello!
What installer did you use?
Have you installed a compiler?
Is the path in "Settings-> Compiler -> Toolchain executables" correct?

Rich_P

Hi, thanks for the reply,

I havnt installed a separate compiler, i downloaded the entire insall from Code::Blocks and assumed the compilers were included?

The compilers installation directory has C:MinGW set,
Under the toolchain variables it has mingw32-gcc.exe in the C compiler list

Hope this helps to explain my situation

Rich

BlueHazzard

Did you installed
codeblocks-12.11-setup.exe
or
codeblocks-12.11mingw-setup.exe
?

if you installed codeblocks-12.11-setup.exe then uninstall and use codeblocks-12.11mingw-setup.exe instead. Or install the gcc from http://tdm-gcc.tdragon.net/

if you have installed codeblocks-12.11mingw-setup.exe:
Is there a mingw32-gcc.exe on your system? If not reinstall.
otherwise point the compilers installation directory to the location of your mingw32-gcc

Rich_P

I had the wrong one installed, so i have installed the correct one and have this issue now

Execution of 'mingw32-g++.exe  -o "C:\simple\Simple 3.exe" "C:\simple\Simple 3.o"' in 'C:\Users\richardpel\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\CodeBlocks' failed.

i selected "C" as my starting langueage but it seems to want to build it using the g++ compiler ? and not gcc?
I have checked int he folder that C::B is pointing to for its compiler and there is the ming32-gcc.exe

im stumped,

thanks

Rich

Jenna

It looks like the ending of your file is ".o" that can never work.
Try to create a simple project with the wizard.

If you create a file make sure you type the correct ending, C::B does not create the ending automagical.

stahta01

#6
Quote from: Rich_P on January 25, 2013, 02:08:25 PM
I had the wrong one installed, so i have installed the correct one and have this issue now

Execution of 'mingw32-g++.exe  -o "C:\simple\Simple 3.exe" "C:\simple\Simple 3.o"' in 'C:\Users\richardpel\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\CodeBlocks' failed.

i selected "C" as my starting langueage but it seems to want to build it using the g++ compiler ? and not gcc?
I have checked int he folder that C::B is pointing to for its compiler and there is the ming32-gcc.exe

im stumped,

thanks

Rich

I am guessing you choose to only install a C compiler and not the C++ compiler.
Please post a full re-build log; so, I can confirm this.

The means do a re-build instead of a build!
After that post the full compiler log; so, I can see the compiler commands.
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F

Edit2: The command you posted in the error message looks like a linking command using the default c++ linker exe.

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Rich_P

HI Tim,
When i open the Hello.C program, and try and BUILD it, i get the error i posted,

I dont get the option to REBUILD it as this option is greyed out in the toolbar.

Sorry to be such a pain in the arse

Hope you can help

Rich

Rich_P


Hi Jens,

I open the Hello.C code from the File..open Menu,

From there, i choose build, and get the error posted, with no option to rebuild

Rich

Rich_P

This is the full build Log from C::B

Thanks

Rich

mingw32-gcc.exe    -c "\\fs02\users\richardpel\C Code\hello.c" -o "\\fs02\users\richardpel\C Code\hello.o"
mingw32-g++.exe  -o "\\fs02\users\richardpel\C Code\hello.exe" "\\fs02\users\richardpel\C Code\hello.o"   
Execution of 'mingw32-g++.exe  -o "\\fs02\users\richardpel\C Code\hello.exe" "\\fs02\users\richardpel\C Code\hello.o"' in 'C:\Users\richardpel\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\CodeBlocks' failed.
Nothing to be done (all items are up-to-date).

Checking for existence: \\fs02\users\richardpel\C Code\hello.exe
Executing: C:\Program Files (x86)\CodeBlocks/cb_console_runner.exe "\\fs02\users\richardpel\C Code\hello.exe" (in \\fs02\users\richardpel\C Code)
Process terminated with status -1073741510 (0 minutes, 44 seconds)


BlueHazzard

Does the \\fs02\users\richardpel\C Code\hello.exe exist?
Have you made a project, or only opened a c file?

Rich_P

HI, The exe does not exist as i assumed this is generated when i click on build?

It is a base .c file i am opening and then pressing build,

I have tried creating from a project, and choosing "c" as the language,

writing the code into the window, saving the file and then building it, buti get the same error each time,

thanks

Rich

Jenna

Try to put the file or better the project into another folder, yours looks like a network folder.
Windows >= 7 is very (very !) restrictive when you try to create executables in folders it thinks you should not do that (without telling you anything about that).

Rich_P

I Will try that Jen,

Just so as i am not being silly, i will describe my process from the start

1, Open C::B
2, Select "Create New Project"
3, Select "files" from left
4, select"C/C++"
5, Select next
6, Select "C"
7, Select the filename and where i want to save it to
8, Click ok
9, Write my "Hello World" code
10, hit save,
11, hit build

Get nothing except the error?

Hmm confused,

I tried building as a project, and importing the Hello.c file and then hitting build, and i got this message

-------------- Build: Debug in Hello (compiler: GNU GCC Compiler)---------------

mingw32-gcc.exe -Wall  -g     -c C:\simple\Hello\Hello.c -o obj\Debug\Hello.o
mingw32-g++.exe  -o bin\Debug\Hello.exe obj\Debug\Hello.o   
Execution of 'mingw32-g++.exe  -o bin\Debug\Hello.exe obj\Debug\Hello.o' in 'C:\simple\Hello' failed.
Nothing to be done (all items are up-to-date).

Am i making progress? lol

Rich

BlueHazzard

"C:\simple\Hello\Hello.c -o obj\Debug\Hello.o"
"C:" is a bad place to save/build data.
Quote from: jens on January 28, 2013, 01:24:02 PM
Try to put the file or better the project into another folder, yours looks like a network folder.
Windows >= 7 is very (very !) restrictive when you try to create executables in folders it thinks you should not do that (without telling you anything about that).

Windows >= 7 is a b***h with the user rights. If you don't have a second partition, to test the build process, try to run codeblocks as admin, or to put your project in your home folder.