How do I compile objective-C in code blocks?












2














I downloaded Codeblocks bundled with GCC from here



The C part is running fine



I read this wiki tutorial which says having GCC will allow me to compile objective C by just adding -lobjc to the compiler options



However, I have followed the steps mentioned in this tutorial and added the -lobjc option, but it doesn't compile



enter image description here



This is the build error message I get in codeblocks:



-------------- Build: Debug in test_prog_proj (compiler: GNU GCC Obj-C Compiler)---------------

mingw32-gcc.exe -Wall -g -c D:backupcb_filesobjc_filestest_prog_projtest_prog.m -o objDebugtest_prog.o
mingw32-gcc.exe: error: CreateProcess: No such file or directory
Process terminated with status 1 (0 minute(s), 2 second(s))
1 error(s), 0 warning(s) (0 minute(s), 2 second(s))


As shown above, it does not show the -lobjc option



I have also tried manually compiling the above program in Windows cmd by going into the folder containing the .m file. I gave the following command:



mingw32-gcc.exe -Wall -g  -c D:backupcb_filesobjc_filestest_prog_projtest_prog.m -o objDebugtest_prog.o -lobjc 


But I get the same error in cmd



mingw32-gcc.exe: error: CreateProcess: No such file or directory  


I also tried



gcc -g -fgnu-runtime -O -c some_class.m  


that I got from here, but it gives me the same CreateProcess error. How do I start compiling Objective C code in Windows (preferably using GCC and Codeblocks) ?



--- EDIT 1 ---



I did as suggested in Mike Kinghan's answer below, and uninstalled my older Codeblocks instgallation, then reinstalled MinGW and codeblocks separately. The Codeblocks uninstall removed the Codeblocks folder in Program Files, but when I reinstalled Codeblocks again (version without MinGW bundled together), the "GNU GCC Obj-C" settings I made with the previous installation was still there, along with the -lobjc flag in the "linker settings" tab.



However, the problem is that it's still not working. I get the following error if I try to build from Codeblocks



Goto "Settings->Compiler...->Global compiler settings->GNU GCC Obj-C Compiler->Toolchain executables" and fix the compiler's setup.

Tried to run compiler executable 'C:Program FilesCodeBlocksMinGW/bin/mingw32-gcc.exe', but failed!

Skipping... Nothing to be done (all items are up-to-date).


This is what Toolchains executable looks like:



enter image description here



If I try to compile it from cmd by going in to the folder with the .m file and issuing the command



mingw32-gcc.exe -Wall -g  -c D:backupcb_filesobjc_filestest_prog_projtest_prog.m -o objDebugtest_prog.o -lobjc  


it gives the error



mingw32-gcc.exe: error: CreateProcess: No such file or directory    


What is the problem here?



--- EDIT 2 ---



Following the suggestion in Mike Kinghan's answer I deleted the old instance of "GNU GCC Obj-C Compiler" in the list of compiliers, and recreated with the current version of "GNU GCC Compiler"



However, the program still does not work. This is the message I get in the build log:



-------------- Build: Debug in test_prog_proj (compiler: GNU GCC Obj-C Compiler)---------------

Linking stage skipped (build target has no object files to link)
Nothing to be done (all items are up-to-date).


Cleaning the project and then building it again gives the same message. Trying to run the project anyway gives me a dialog box saying the project is not built, and clicking on Yes to build the project just pops the same "project not built yet" dialog box up again. The file icons in the Workspace tree of the Projects tab also seem to be grayed out:



enter image description here



This is what Toolchain Executable looks like:



enter image description here



I have added -lobjc in Linker Settings as mentioned here as well.



I right clicked the project icon in the Project tree, went to Build Options and added -lobjc in the Linker Settings as well:



enter image description here



What is the problem with this project at the moment?



--- EDIT 3 ---



I ended up completely uninstalling Codeblocks (uninstall from windows start menu, delete codeblocks folder in %APPDATA%), uninstalling MinGW (deleting the c:MinGW folder) and reinstalling everything from scratch. I followed all the instructions in the Wiki (except the Troubleshooting section, but I think that part is irrelevant) and it still doesn't work (same problem as described in Edit 2 in this post).



How do I get Codeblocks to detect and compile obj-C code? Also, it is not showing me the compiler command line arguments when I try to build it from the Codeblocks interface. Why is this and how can I get it to show me whatever the full command line it is using?










share|improve this question
























  • Somewhere beneath the libexec folder of your MinGW installation you will find a program called cc1.exe. (In my case, C:MinGWlibexecgccmingw326.3.0cc1.exe). In the same folder as cc1.exe, do you see a program called cc1obj.exe?
    – Mike Kinghan
    Nov 11 at 9:40










  • @MikeKinghan there's only cc1.exe at C:Program FilesCodeBlocksMinGWlibexecgccmingw324.9.2
    – user13267
    Nov 11 at 11:01










  • does this mean i don't have the objective c compiler?
    – user13267
    Nov 11 at 11:02


















2














I downloaded Codeblocks bundled with GCC from here



The C part is running fine



I read this wiki tutorial which says having GCC will allow me to compile objective C by just adding -lobjc to the compiler options



However, I have followed the steps mentioned in this tutorial and added the -lobjc option, but it doesn't compile



enter image description here



This is the build error message I get in codeblocks:



-------------- Build: Debug in test_prog_proj (compiler: GNU GCC Obj-C Compiler)---------------

mingw32-gcc.exe -Wall -g -c D:backupcb_filesobjc_filestest_prog_projtest_prog.m -o objDebugtest_prog.o
mingw32-gcc.exe: error: CreateProcess: No such file or directory
Process terminated with status 1 (0 minute(s), 2 second(s))
1 error(s), 0 warning(s) (0 minute(s), 2 second(s))


As shown above, it does not show the -lobjc option



I have also tried manually compiling the above program in Windows cmd by going into the folder containing the .m file. I gave the following command:



mingw32-gcc.exe -Wall -g  -c D:backupcb_filesobjc_filestest_prog_projtest_prog.m -o objDebugtest_prog.o -lobjc 


But I get the same error in cmd



mingw32-gcc.exe: error: CreateProcess: No such file or directory  


I also tried



gcc -g -fgnu-runtime -O -c some_class.m  


that I got from here, but it gives me the same CreateProcess error. How do I start compiling Objective C code in Windows (preferably using GCC and Codeblocks) ?



--- EDIT 1 ---



I did as suggested in Mike Kinghan's answer below, and uninstalled my older Codeblocks instgallation, then reinstalled MinGW and codeblocks separately. The Codeblocks uninstall removed the Codeblocks folder in Program Files, but when I reinstalled Codeblocks again (version without MinGW bundled together), the "GNU GCC Obj-C" settings I made with the previous installation was still there, along with the -lobjc flag in the "linker settings" tab.



However, the problem is that it's still not working. I get the following error if I try to build from Codeblocks



Goto "Settings->Compiler...->Global compiler settings->GNU GCC Obj-C Compiler->Toolchain executables" and fix the compiler's setup.

Tried to run compiler executable 'C:Program FilesCodeBlocksMinGW/bin/mingw32-gcc.exe', but failed!

Skipping... Nothing to be done (all items are up-to-date).


This is what Toolchains executable looks like:



enter image description here



If I try to compile it from cmd by going in to the folder with the .m file and issuing the command



mingw32-gcc.exe -Wall -g  -c D:backupcb_filesobjc_filestest_prog_projtest_prog.m -o objDebugtest_prog.o -lobjc  


it gives the error



mingw32-gcc.exe: error: CreateProcess: No such file or directory    


What is the problem here?



--- EDIT 2 ---



Following the suggestion in Mike Kinghan's answer I deleted the old instance of "GNU GCC Obj-C Compiler" in the list of compiliers, and recreated with the current version of "GNU GCC Compiler"



However, the program still does not work. This is the message I get in the build log:



-------------- Build: Debug in test_prog_proj (compiler: GNU GCC Obj-C Compiler)---------------

Linking stage skipped (build target has no object files to link)
Nothing to be done (all items are up-to-date).


Cleaning the project and then building it again gives the same message. Trying to run the project anyway gives me a dialog box saying the project is not built, and clicking on Yes to build the project just pops the same "project not built yet" dialog box up again. The file icons in the Workspace tree of the Projects tab also seem to be grayed out:



enter image description here



This is what Toolchain Executable looks like:



enter image description here



I have added -lobjc in Linker Settings as mentioned here as well.



I right clicked the project icon in the Project tree, went to Build Options and added -lobjc in the Linker Settings as well:



enter image description here



What is the problem with this project at the moment?



--- EDIT 3 ---



I ended up completely uninstalling Codeblocks (uninstall from windows start menu, delete codeblocks folder in %APPDATA%), uninstalling MinGW (deleting the c:MinGW folder) and reinstalling everything from scratch. I followed all the instructions in the Wiki (except the Troubleshooting section, but I think that part is irrelevant) and it still doesn't work (same problem as described in Edit 2 in this post).



How do I get Codeblocks to detect and compile obj-C code? Also, it is not showing me the compiler command line arguments when I try to build it from the Codeblocks interface. Why is this and how can I get it to show me whatever the full command line it is using?










share|improve this question
























  • Somewhere beneath the libexec folder of your MinGW installation you will find a program called cc1.exe. (In my case, C:MinGWlibexecgccmingw326.3.0cc1.exe). In the same folder as cc1.exe, do you see a program called cc1obj.exe?
    – Mike Kinghan
    Nov 11 at 9:40










  • @MikeKinghan there's only cc1.exe at C:Program FilesCodeBlocksMinGWlibexecgccmingw324.9.2
    – user13267
    Nov 11 at 11:01










  • does this mean i don't have the objective c compiler?
    – user13267
    Nov 11 at 11:02
















2












2








2


0





I downloaded Codeblocks bundled with GCC from here



The C part is running fine



I read this wiki tutorial which says having GCC will allow me to compile objective C by just adding -lobjc to the compiler options



However, I have followed the steps mentioned in this tutorial and added the -lobjc option, but it doesn't compile



enter image description here



This is the build error message I get in codeblocks:



-------------- Build: Debug in test_prog_proj (compiler: GNU GCC Obj-C Compiler)---------------

mingw32-gcc.exe -Wall -g -c D:backupcb_filesobjc_filestest_prog_projtest_prog.m -o objDebugtest_prog.o
mingw32-gcc.exe: error: CreateProcess: No such file or directory
Process terminated with status 1 (0 minute(s), 2 second(s))
1 error(s), 0 warning(s) (0 minute(s), 2 second(s))


As shown above, it does not show the -lobjc option



I have also tried manually compiling the above program in Windows cmd by going into the folder containing the .m file. I gave the following command:



mingw32-gcc.exe -Wall -g  -c D:backupcb_filesobjc_filestest_prog_projtest_prog.m -o objDebugtest_prog.o -lobjc 


But I get the same error in cmd



mingw32-gcc.exe: error: CreateProcess: No such file or directory  


I also tried



gcc -g -fgnu-runtime -O -c some_class.m  


that I got from here, but it gives me the same CreateProcess error. How do I start compiling Objective C code in Windows (preferably using GCC and Codeblocks) ?



--- EDIT 1 ---



I did as suggested in Mike Kinghan's answer below, and uninstalled my older Codeblocks instgallation, then reinstalled MinGW and codeblocks separately. The Codeblocks uninstall removed the Codeblocks folder in Program Files, but when I reinstalled Codeblocks again (version without MinGW bundled together), the "GNU GCC Obj-C" settings I made with the previous installation was still there, along with the -lobjc flag in the "linker settings" tab.



However, the problem is that it's still not working. I get the following error if I try to build from Codeblocks



Goto "Settings->Compiler...->Global compiler settings->GNU GCC Obj-C Compiler->Toolchain executables" and fix the compiler's setup.

Tried to run compiler executable 'C:Program FilesCodeBlocksMinGW/bin/mingw32-gcc.exe', but failed!

Skipping... Nothing to be done (all items are up-to-date).


This is what Toolchains executable looks like:



enter image description here



If I try to compile it from cmd by going in to the folder with the .m file and issuing the command



mingw32-gcc.exe -Wall -g  -c D:backupcb_filesobjc_filestest_prog_projtest_prog.m -o objDebugtest_prog.o -lobjc  


it gives the error



mingw32-gcc.exe: error: CreateProcess: No such file or directory    


What is the problem here?



--- EDIT 2 ---



Following the suggestion in Mike Kinghan's answer I deleted the old instance of "GNU GCC Obj-C Compiler" in the list of compiliers, and recreated with the current version of "GNU GCC Compiler"



However, the program still does not work. This is the message I get in the build log:



-------------- Build: Debug in test_prog_proj (compiler: GNU GCC Obj-C Compiler)---------------

Linking stage skipped (build target has no object files to link)
Nothing to be done (all items are up-to-date).


Cleaning the project and then building it again gives the same message. Trying to run the project anyway gives me a dialog box saying the project is not built, and clicking on Yes to build the project just pops the same "project not built yet" dialog box up again. The file icons in the Workspace tree of the Projects tab also seem to be grayed out:



enter image description here



This is what Toolchain Executable looks like:



enter image description here



I have added -lobjc in Linker Settings as mentioned here as well.



I right clicked the project icon in the Project tree, went to Build Options and added -lobjc in the Linker Settings as well:



enter image description here



What is the problem with this project at the moment?



--- EDIT 3 ---



I ended up completely uninstalling Codeblocks (uninstall from windows start menu, delete codeblocks folder in %APPDATA%), uninstalling MinGW (deleting the c:MinGW folder) and reinstalling everything from scratch. I followed all the instructions in the Wiki (except the Troubleshooting section, but I think that part is irrelevant) and it still doesn't work (same problem as described in Edit 2 in this post).



How do I get Codeblocks to detect and compile obj-C code? Also, it is not showing me the compiler command line arguments when I try to build it from the Codeblocks interface. Why is this and how can I get it to show me whatever the full command line it is using?










share|improve this question















I downloaded Codeblocks bundled with GCC from here



The C part is running fine



I read this wiki tutorial which says having GCC will allow me to compile objective C by just adding -lobjc to the compiler options



However, I have followed the steps mentioned in this tutorial and added the -lobjc option, but it doesn't compile



enter image description here



This is the build error message I get in codeblocks:



-------------- Build: Debug in test_prog_proj (compiler: GNU GCC Obj-C Compiler)---------------

mingw32-gcc.exe -Wall -g -c D:backupcb_filesobjc_filestest_prog_projtest_prog.m -o objDebugtest_prog.o
mingw32-gcc.exe: error: CreateProcess: No such file or directory
Process terminated with status 1 (0 minute(s), 2 second(s))
1 error(s), 0 warning(s) (0 minute(s), 2 second(s))


As shown above, it does not show the -lobjc option



I have also tried manually compiling the above program in Windows cmd by going into the folder containing the .m file. I gave the following command:



mingw32-gcc.exe -Wall -g  -c D:backupcb_filesobjc_filestest_prog_projtest_prog.m -o objDebugtest_prog.o -lobjc 


But I get the same error in cmd



mingw32-gcc.exe: error: CreateProcess: No such file or directory  


I also tried



gcc -g -fgnu-runtime -O -c some_class.m  


that I got from here, but it gives me the same CreateProcess error. How do I start compiling Objective C code in Windows (preferably using GCC and Codeblocks) ?



--- EDIT 1 ---



I did as suggested in Mike Kinghan's answer below, and uninstalled my older Codeblocks instgallation, then reinstalled MinGW and codeblocks separately. The Codeblocks uninstall removed the Codeblocks folder in Program Files, but when I reinstalled Codeblocks again (version without MinGW bundled together), the "GNU GCC Obj-C" settings I made with the previous installation was still there, along with the -lobjc flag in the "linker settings" tab.



However, the problem is that it's still not working. I get the following error if I try to build from Codeblocks



Goto "Settings->Compiler...->Global compiler settings->GNU GCC Obj-C Compiler->Toolchain executables" and fix the compiler's setup.

Tried to run compiler executable 'C:Program FilesCodeBlocksMinGW/bin/mingw32-gcc.exe', but failed!

Skipping... Nothing to be done (all items are up-to-date).


This is what Toolchains executable looks like:



enter image description here



If I try to compile it from cmd by going in to the folder with the .m file and issuing the command



mingw32-gcc.exe -Wall -g  -c D:backupcb_filesobjc_filestest_prog_projtest_prog.m -o objDebugtest_prog.o -lobjc  


it gives the error



mingw32-gcc.exe: error: CreateProcess: No such file or directory    


What is the problem here?



--- EDIT 2 ---



Following the suggestion in Mike Kinghan's answer I deleted the old instance of "GNU GCC Obj-C Compiler" in the list of compiliers, and recreated with the current version of "GNU GCC Compiler"



However, the program still does not work. This is the message I get in the build log:



-------------- Build: Debug in test_prog_proj (compiler: GNU GCC Obj-C Compiler)---------------

Linking stage skipped (build target has no object files to link)
Nothing to be done (all items are up-to-date).


Cleaning the project and then building it again gives the same message. Trying to run the project anyway gives me a dialog box saying the project is not built, and clicking on Yes to build the project just pops the same "project not built yet" dialog box up again. The file icons in the Workspace tree of the Projects tab also seem to be grayed out:



enter image description here



This is what Toolchain Executable looks like:



enter image description here



I have added -lobjc in Linker Settings as mentioned here as well.



I right clicked the project icon in the Project tree, went to Build Options and added -lobjc in the Linker Settings as well:



enter image description here



What is the problem with this project at the moment?



--- EDIT 3 ---



I ended up completely uninstalling Codeblocks (uninstall from windows start menu, delete codeblocks folder in %APPDATA%), uninstalling MinGW (deleting the c:MinGW folder) and reinstalling everything from scratch. I followed all the instructions in the Wiki (except the Troubleshooting section, but I think that part is irrelevant) and it still doesn't work (same problem as described in Edit 2 in this post).



How do I get Codeblocks to detect and compile obj-C code? Also, it is not showing me the compiler command line arguments when I try to build it from the Codeblocks interface. Why is this and how can I get it to show me whatever the full command line it is using?







objective-c gcc codeblocks






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 at 10:27

























asked Nov 11 at 5:25









user13267

2,679165591




2,679165591












  • Somewhere beneath the libexec folder of your MinGW installation you will find a program called cc1.exe. (In my case, C:MinGWlibexecgccmingw326.3.0cc1.exe). In the same folder as cc1.exe, do you see a program called cc1obj.exe?
    – Mike Kinghan
    Nov 11 at 9:40










  • @MikeKinghan there's only cc1.exe at C:Program FilesCodeBlocksMinGWlibexecgccmingw324.9.2
    – user13267
    Nov 11 at 11:01










  • does this mean i don't have the objective c compiler?
    – user13267
    Nov 11 at 11:02




















  • Somewhere beneath the libexec folder of your MinGW installation you will find a program called cc1.exe. (In my case, C:MinGWlibexecgccmingw326.3.0cc1.exe). In the same folder as cc1.exe, do you see a program called cc1obj.exe?
    – Mike Kinghan
    Nov 11 at 9:40










  • @MikeKinghan there's only cc1.exe at C:Program FilesCodeBlocksMinGWlibexecgccmingw324.9.2
    – user13267
    Nov 11 at 11:01










  • does this mean i don't have the objective c compiler?
    – user13267
    Nov 11 at 11:02


















Somewhere beneath the libexec folder of your MinGW installation you will find a program called cc1.exe. (In my case, C:MinGWlibexecgccmingw326.3.0cc1.exe). In the same folder as cc1.exe, do you see a program called cc1obj.exe?
– Mike Kinghan
Nov 11 at 9:40




Somewhere beneath the libexec folder of your MinGW installation you will find a program called cc1.exe. (In my case, C:MinGWlibexecgccmingw326.3.0cc1.exe). In the same folder as cc1.exe, do you see a program called cc1obj.exe?
– Mike Kinghan
Nov 11 at 9:40












@MikeKinghan there's only cc1.exe at C:Program FilesCodeBlocksMinGWlibexecgccmingw324.9.2
– user13267
Nov 11 at 11:01




@MikeKinghan there's only cc1.exe at C:Program FilesCodeBlocksMinGWlibexecgccmingw324.9.2
– user13267
Nov 11 at 11:01












does this mean i don't have the objective c compiler?
– user13267
Nov 11 at 11:02






does this mean i don't have the objective c compiler?
– user13267
Nov 11 at 11:02














1 Answer
1






active

oldest

votes


















2














The GCC program we loosely call the "the compiler" - [mingw32-](gcc|g++) -
is actually a compiler/linker frontend that invokes a real language
compiler and/or linker depending on what the input files and commandline options
indicate you want it to do.



Input files with an .m extension indicate they are Objective C source files
that are to be compiled with the GNU Objective C compiler, cc1obj. But you
haven't got it. Hence the failure you see.



A GCC installation will include the C compiler cc1 and, optionally, compilers
for other languages - C++, Fortran, Objective (C|C++), Go ... You say you got your MinGW GCC installation as
bundled with Code::Blocks. That bundled MinGW omits the Objective C compiler, cc1obj , because the maintainers
reckon it a niche language.



Best remove your CB installation and bundled MinGW and then install MinGW GCC independently from
one of the rival projects:-



https://sourceforge.net/projects/mingw-w64/
https://sourceforge.net/projects/mingw/


Run the installer and ensure that you get Objective C as well as any other compilers you
want.



After that, replace your CB installation it with the codeblocks-17.12-setup.exe installer (not codeblocks-17.12mingw-setup.exe),
from https://sourceforge.net/projects/codeblocks/files/Binaries/17.12/Windows/. This installer includes no compilers and
will auto-detect your MinGW installation.



Then proceed as you already did to create a GNU GCC Obj-C compiler setup in the CB IDE.



Later ... still not working



Your GNU GCC Obj-C compiler-setup has persisted from your previous
CB install and has been rendered out-of-date by the fact that your
new MinGW installation is no longer part of Code::Blocks. As you see,
it still looks for the toolchain executables in C:Program FilesCodeblocksMinGW,
whereas your new MinGW is somewhere else.



When you reinstalled Code::Blocks you should have seen its attempt to auto-detect compilers,
and that it detected your MinGW toolchain in (say) C:MinGW. It will have configured
a compiler setup for GNU GCC Compiler on that basis, with the correct path to
the toolchain executables. But it will not have modified any persisting compiler setups that
you created yourself, such as GNU GCC Obj-C.



First check that the auto-detected setup GNU GCC Compiler is good just
by creating a "Hello world" C console project and seeing that you can build it.
I assume you'll be able to, but if not, then go into the GNU GCC Compiler setup
yourself and manually set the Compiler's installation directory correctly.



Then, set the same Compiler's installation directory for your GNU GCC Obj-C
compiler setup.






share|improve this answer























  • hi could you please have a look my edit? I got the cc1obj.exe file, but it's still not working
    – user13267
    Nov 12 at 12:46










  • @user13267 Hi, see update
    – Mike Kinghan
    Nov 12 at 14:55










  • thank you for the update. I'm not at that computer anymore so I will only be able to do detail tests later, but I have already checked that a C console "hello world" project compiles normally
    – user13267
    Nov 13 at 0:14










  • Hi, please check my edit 2
    – user13267
    Nov 13 at 12:48










  • Well your compiler is now being found and run :) - which solves the original problem and reveals some new one. Clean the project (Menubar -> Build -> Clean), then Build -> Build; then post the complete contents of the Build log (not Build messages) tab if it is at all different from what you already posted. If Clean produces any errors, then post that log first.
    – Mike Kinghan
    Nov 13 at 13:29











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53246084%2fhow-do-i-compile-objective-c-in-code-blocks%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














The GCC program we loosely call the "the compiler" - [mingw32-](gcc|g++) -
is actually a compiler/linker frontend that invokes a real language
compiler and/or linker depending on what the input files and commandline options
indicate you want it to do.



Input files with an .m extension indicate they are Objective C source files
that are to be compiled with the GNU Objective C compiler, cc1obj. But you
haven't got it. Hence the failure you see.



A GCC installation will include the C compiler cc1 and, optionally, compilers
for other languages - C++, Fortran, Objective (C|C++), Go ... You say you got your MinGW GCC installation as
bundled with Code::Blocks. That bundled MinGW omits the Objective C compiler, cc1obj , because the maintainers
reckon it a niche language.



Best remove your CB installation and bundled MinGW and then install MinGW GCC independently from
one of the rival projects:-



https://sourceforge.net/projects/mingw-w64/
https://sourceforge.net/projects/mingw/


Run the installer and ensure that you get Objective C as well as any other compilers you
want.



After that, replace your CB installation it with the codeblocks-17.12-setup.exe installer (not codeblocks-17.12mingw-setup.exe),
from https://sourceforge.net/projects/codeblocks/files/Binaries/17.12/Windows/. This installer includes no compilers and
will auto-detect your MinGW installation.



Then proceed as you already did to create a GNU GCC Obj-C compiler setup in the CB IDE.



Later ... still not working



Your GNU GCC Obj-C compiler-setup has persisted from your previous
CB install and has been rendered out-of-date by the fact that your
new MinGW installation is no longer part of Code::Blocks. As you see,
it still looks for the toolchain executables in C:Program FilesCodeblocksMinGW,
whereas your new MinGW is somewhere else.



When you reinstalled Code::Blocks you should have seen its attempt to auto-detect compilers,
and that it detected your MinGW toolchain in (say) C:MinGW. It will have configured
a compiler setup for GNU GCC Compiler on that basis, with the correct path to
the toolchain executables. But it will not have modified any persisting compiler setups that
you created yourself, such as GNU GCC Obj-C.



First check that the auto-detected setup GNU GCC Compiler is good just
by creating a "Hello world" C console project and seeing that you can build it.
I assume you'll be able to, but if not, then go into the GNU GCC Compiler setup
yourself and manually set the Compiler's installation directory correctly.



Then, set the same Compiler's installation directory for your GNU GCC Obj-C
compiler setup.






share|improve this answer























  • hi could you please have a look my edit? I got the cc1obj.exe file, but it's still not working
    – user13267
    Nov 12 at 12:46










  • @user13267 Hi, see update
    – Mike Kinghan
    Nov 12 at 14:55










  • thank you for the update. I'm not at that computer anymore so I will only be able to do detail tests later, but I have already checked that a C console "hello world" project compiles normally
    – user13267
    Nov 13 at 0:14










  • Hi, please check my edit 2
    – user13267
    Nov 13 at 12:48










  • Well your compiler is now being found and run :) - which solves the original problem and reveals some new one. Clean the project (Menubar -> Build -> Clean), then Build -> Build; then post the complete contents of the Build log (not Build messages) tab if it is at all different from what you already posted. If Clean produces any errors, then post that log first.
    – Mike Kinghan
    Nov 13 at 13:29
















2














The GCC program we loosely call the "the compiler" - [mingw32-](gcc|g++) -
is actually a compiler/linker frontend that invokes a real language
compiler and/or linker depending on what the input files and commandline options
indicate you want it to do.



Input files with an .m extension indicate they are Objective C source files
that are to be compiled with the GNU Objective C compiler, cc1obj. But you
haven't got it. Hence the failure you see.



A GCC installation will include the C compiler cc1 and, optionally, compilers
for other languages - C++, Fortran, Objective (C|C++), Go ... You say you got your MinGW GCC installation as
bundled with Code::Blocks. That bundled MinGW omits the Objective C compiler, cc1obj , because the maintainers
reckon it a niche language.



Best remove your CB installation and bundled MinGW and then install MinGW GCC independently from
one of the rival projects:-



https://sourceforge.net/projects/mingw-w64/
https://sourceforge.net/projects/mingw/


Run the installer and ensure that you get Objective C as well as any other compilers you
want.



After that, replace your CB installation it with the codeblocks-17.12-setup.exe installer (not codeblocks-17.12mingw-setup.exe),
from https://sourceforge.net/projects/codeblocks/files/Binaries/17.12/Windows/. This installer includes no compilers and
will auto-detect your MinGW installation.



Then proceed as you already did to create a GNU GCC Obj-C compiler setup in the CB IDE.



Later ... still not working



Your GNU GCC Obj-C compiler-setup has persisted from your previous
CB install and has been rendered out-of-date by the fact that your
new MinGW installation is no longer part of Code::Blocks. As you see,
it still looks for the toolchain executables in C:Program FilesCodeblocksMinGW,
whereas your new MinGW is somewhere else.



When you reinstalled Code::Blocks you should have seen its attempt to auto-detect compilers,
and that it detected your MinGW toolchain in (say) C:MinGW. It will have configured
a compiler setup for GNU GCC Compiler on that basis, with the correct path to
the toolchain executables. But it will not have modified any persisting compiler setups that
you created yourself, such as GNU GCC Obj-C.



First check that the auto-detected setup GNU GCC Compiler is good just
by creating a "Hello world" C console project and seeing that you can build it.
I assume you'll be able to, but if not, then go into the GNU GCC Compiler setup
yourself and manually set the Compiler's installation directory correctly.



Then, set the same Compiler's installation directory for your GNU GCC Obj-C
compiler setup.






share|improve this answer























  • hi could you please have a look my edit? I got the cc1obj.exe file, but it's still not working
    – user13267
    Nov 12 at 12:46










  • @user13267 Hi, see update
    – Mike Kinghan
    Nov 12 at 14:55










  • thank you for the update. I'm not at that computer anymore so I will only be able to do detail tests later, but I have already checked that a C console "hello world" project compiles normally
    – user13267
    Nov 13 at 0:14










  • Hi, please check my edit 2
    – user13267
    Nov 13 at 12:48










  • Well your compiler is now being found and run :) - which solves the original problem and reveals some new one. Clean the project (Menubar -> Build -> Clean), then Build -> Build; then post the complete contents of the Build log (not Build messages) tab if it is at all different from what you already posted. If Clean produces any errors, then post that log first.
    – Mike Kinghan
    Nov 13 at 13:29














2












2








2






The GCC program we loosely call the "the compiler" - [mingw32-](gcc|g++) -
is actually a compiler/linker frontend that invokes a real language
compiler and/or linker depending on what the input files and commandline options
indicate you want it to do.



Input files with an .m extension indicate they are Objective C source files
that are to be compiled with the GNU Objective C compiler, cc1obj. But you
haven't got it. Hence the failure you see.



A GCC installation will include the C compiler cc1 and, optionally, compilers
for other languages - C++, Fortran, Objective (C|C++), Go ... You say you got your MinGW GCC installation as
bundled with Code::Blocks. That bundled MinGW omits the Objective C compiler, cc1obj , because the maintainers
reckon it a niche language.



Best remove your CB installation and bundled MinGW and then install MinGW GCC independently from
one of the rival projects:-



https://sourceforge.net/projects/mingw-w64/
https://sourceforge.net/projects/mingw/


Run the installer and ensure that you get Objective C as well as any other compilers you
want.



After that, replace your CB installation it with the codeblocks-17.12-setup.exe installer (not codeblocks-17.12mingw-setup.exe),
from https://sourceforge.net/projects/codeblocks/files/Binaries/17.12/Windows/. This installer includes no compilers and
will auto-detect your MinGW installation.



Then proceed as you already did to create a GNU GCC Obj-C compiler setup in the CB IDE.



Later ... still not working



Your GNU GCC Obj-C compiler-setup has persisted from your previous
CB install and has been rendered out-of-date by the fact that your
new MinGW installation is no longer part of Code::Blocks. As you see,
it still looks for the toolchain executables in C:Program FilesCodeblocksMinGW,
whereas your new MinGW is somewhere else.



When you reinstalled Code::Blocks you should have seen its attempt to auto-detect compilers,
and that it detected your MinGW toolchain in (say) C:MinGW. It will have configured
a compiler setup for GNU GCC Compiler on that basis, with the correct path to
the toolchain executables. But it will not have modified any persisting compiler setups that
you created yourself, such as GNU GCC Obj-C.



First check that the auto-detected setup GNU GCC Compiler is good just
by creating a "Hello world" C console project and seeing that you can build it.
I assume you'll be able to, but if not, then go into the GNU GCC Compiler setup
yourself and manually set the Compiler's installation directory correctly.



Then, set the same Compiler's installation directory for your GNU GCC Obj-C
compiler setup.






share|improve this answer














The GCC program we loosely call the "the compiler" - [mingw32-](gcc|g++) -
is actually a compiler/linker frontend that invokes a real language
compiler and/or linker depending on what the input files and commandline options
indicate you want it to do.



Input files with an .m extension indicate they are Objective C source files
that are to be compiled with the GNU Objective C compiler, cc1obj. But you
haven't got it. Hence the failure you see.



A GCC installation will include the C compiler cc1 and, optionally, compilers
for other languages - C++, Fortran, Objective (C|C++), Go ... You say you got your MinGW GCC installation as
bundled with Code::Blocks. That bundled MinGW omits the Objective C compiler, cc1obj , because the maintainers
reckon it a niche language.



Best remove your CB installation and bundled MinGW and then install MinGW GCC independently from
one of the rival projects:-



https://sourceforge.net/projects/mingw-w64/
https://sourceforge.net/projects/mingw/


Run the installer and ensure that you get Objective C as well as any other compilers you
want.



After that, replace your CB installation it with the codeblocks-17.12-setup.exe installer (not codeblocks-17.12mingw-setup.exe),
from https://sourceforge.net/projects/codeblocks/files/Binaries/17.12/Windows/. This installer includes no compilers and
will auto-detect your MinGW installation.



Then proceed as you already did to create a GNU GCC Obj-C compiler setup in the CB IDE.



Later ... still not working



Your GNU GCC Obj-C compiler-setup has persisted from your previous
CB install and has been rendered out-of-date by the fact that your
new MinGW installation is no longer part of Code::Blocks. As you see,
it still looks for the toolchain executables in C:Program FilesCodeblocksMinGW,
whereas your new MinGW is somewhere else.



When you reinstalled Code::Blocks you should have seen its attempt to auto-detect compilers,
and that it detected your MinGW toolchain in (say) C:MinGW. It will have configured
a compiler setup for GNU GCC Compiler on that basis, with the correct path to
the toolchain executables. But it will not have modified any persisting compiler setups that
you created yourself, such as GNU GCC Obj-C.



First check that the auto-detected setup GNU GCC Compiler is good just
by creating a "Hello world" C console project and seeing that you can build it.
I assume you'll be able to, but if not, then go into the GNU GCC Compiler setup
yourself and manually set the Compiler's installation directory correctly.



Then, set the same Compiler's installation directory for your GNU GCC Obj-C
compiler setup.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 12 at 14:54

























answered Nov 11 at 12:09









Mike Kinghan

29.9k763110




29.9k763110












  • hi could you please have a look my edit? I got the cc1obj.exe file, but it's still not working
    – user13267
    Nov 12 at 12:46










  • @user13267 Hi, see update
    – Mike Kinghan
    Nov 12 at 14:55










  • thank you for the update. I'm not at that computer anymore so I will only be able to do detail tests later, but I have already checked that a C console "hello world" project compiles normally
    – user13267
    Nov 13 at 0:14










  • Hi, please check my edit 2
    – user13267
    Nov 13 at 12:48










  • Well your compiler is now being found and run :) - which solves the original problem and reveals some new one. Clean the project (Menubar -> Build -> Clean), then Build -> Build; then post the complete contents of the Build log (not Build messages) tab if it is at all different from what you already posted. If Clean produces any errors, then post that log first.
    – Mike Kinghan
    Nov 13 at 13:29


















  • hi could you please have a look my edit? I got the cc1obj.exe file, but it's still not working
    – user13267
    Nov 12 at 12:46










  • @user13267 Hi, see update
    – Mike Kinghan
    Nov 12 at 14:55










  • thank you for the update. I'm not at that computer anymore so I will only be able to do detail tests later, but I have already checked that a C console "hello world" project compiles normally
    – user13267
    Nov 13 at 0:14










  • Hi, please check my edit 2
    – user13267
    Nov 13 at 12:48










  • Well your compiler is now being found and run :) - which solves the original problem and reveals some new one. Clean the project (Menubar -> Build -> Clean), then Build -> Build; then post the complete contents of the Build log (not Build messages) tab if it is at all different from what you already posted. If Clean produces any errors, then post that log first.
    – Mike Kinghan
    Nov 13 at 13:29
















hi could you please have a look my edit? I got the cc1obj.exe file, but it's still not working
– user13267
Nov 12 at 12:46




hi could you please have a look my edit? I got the cc1obj.exe file, but it's still not working
– user13267
Nov 12 at 12:46












@user13267 Hi, see update
– Mike Kinghan
Nov 12 at 14:55




@user13267 Hi, see update
– Mike Kinghan
Nov 12 at 14:55












thank you for the update. I'm not at that computer anymore so I will only be able to do detail tests later, but I have already checked that a C console "hello world" project compiles normally
– user13267
Nov 13 at 0:14




thank you for the update. I'm not at that computer anymore so I will only be able to do detail tests later, but I have already checked that a C console "hello world" project compiles normally
– user13267
Nov 13 at 0:14












Hi, please check my edit 2
– user13267
Nov 13 at 12:48




Hi, please check my edit 2
– user13267
Nov 13 at 12:48












Well your compiler is now being found and run :) - which solves the original problem and reveals some new one. Clean the project (Menubar -> Build -> Clean), then Build -> Build; then post the complete contents of the Build log (not Build messages) tab if it is at all different from what you already posted. If Clean produces any errors, then post that log first.
– Mike Kinghan
Nov 13 at 13:29




Well your compiler is now being found and run :) - which solves the original problem and reveals some new one. Clean the project (Menubar -> Build -> Clean), then Build -> Build; then post the complete contents of the Build log (not Build messages) tab if it is at all different from what you already posted. If Clean produces any errors, then post that log first.
– Mike Kinghan
Nov 13 at 13:29


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53246084%2fhow-do-i-compile-objective-c-in-code-blocks%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Xamarin.form Move up view when keyboard appear

Post-Redirect-Get with Spring WebFlux and Thymeleaf

Anylogic : not able to use stopDelay()