Poll
Question:
Newbie! Error building simple C code
Option 1: unsure
votes: 0
Option 2: unsure
votes: 0
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
Hello!
What installer did you use?
Have you installed a compiler?
Is the path in "Settings-> Compiler -> Toolchain executables" correct?
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
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
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
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.
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 (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.
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
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
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)
Does the \\fs02\users\richardpel\C Code\hello.exe exist?
Have you made a project, or only opened a c file?
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
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).
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
"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.
I would say, it should work there.
Please verify that mingw32-g++.exe exists (in the bin-folder below the toolvhains masterpath) and is executable.
The only partition i have on the local machine is C:\
Running as administrator makes no difference
Looking into the directors for MinGW
The directory being ,
C:\MinGW\bin\ ( supposed file )
in this dir i have the following
mingw32-cc.exe
mingw32-gcc.exe
mingw32-gcc-4.6.2.exe
mingw32-make.exe
Cheers
Rich
You (obviously) miss mingw32-g++.exe.
Pleaee install also the c++ compiler or (if you are really sure, that you never want to use c++) you can use migw32-gcc.exe as dynamic linker.
If you have installed codeblocks-12.11mingw-setup.exe, make sure the compilers masterpath points to the correct directoy.
It should be the MinGW-folder below C::B's installation directory.
Quote from: jens on January 28, 2013, 03:41:04 PM
You (obviously) miss mingw32-g++.exe.
Pleaee install also the c++ compiler or (if you are really sure, that you never want to use c++) you can use migw32-gcc.exe as dynamic linker.
If you have installed codeblocks-12.11mingw-setup.exe, make sure the compilers masterpath points to the correct directoy.
It should be the MinGW-folder below C::B's installation directory.
Remember most Mingw Installations will NOT work if there is a C:\MinGW MinGW installation in addition to the installation trying to be used.
Tim S.
OK Guys
I am getting confused here and i have to apologise for my lack of experience,
I have now uninstalled C:B and removed any trace of MinGW from my computer,
I have downloaded the latest version of CodeBlocks , codeblocks-12.11mingw-setup
Is this all i need to get started? or do i need to download something else?
Can you advise ?
Jens, Where do i get the C++ compiler from? do i need to download it?
Tim, i have now removed all trace, there was a MinGW folder in C:\ but i am pretty sure that CodeBlocks installed that there,
Thanks so far guys :)
Rich
Thanks
Rich
OK Guys , i am starting to win,
After reinstalling C::B ( in admin mode ) :)
and checking all file paths, and clicking reset on the the compiler settings, i now have a working compilier,
I checked using a project i half built before, and it can compile and run,
When i tried to create a NEW project, and building it, i get this..
-------------- Build: Debug in Hello2 (compiler: GNU GCC Compiler)---------------
Linking stage skipped (build target has no object files to link)
Nothing to be done (all items are up-to-date).
I am not sure what a "linker" is, so maybe you could direct me
thankyou so much
Rich
Right, I have twigged it now
:-)
Its simply my complete lack of experience, i needed to add the source file to the project file for it to link and compile,
Thankyou guys, for all of the patience and help,
I am sure i willbe back to ask more questions,
I will try my hardest to work the answer out myself first :)
Thanks again
Rich