I am running Ubuntu in a virtual machine and I keep getting this error when I try to execute i686-w64-mingw32-gcc -o test.dll hello.m -objc in order to cross-compile an objective c project for windows. I get the following error:

i686-w64-mingw32-gcc: error trying to exec 'cc1obj': execvp: No such file or directory
  • What version of Ubuntu is it, and how / from where did you install the cross-compiler toolchain? it looks like maybe a required Objective-C++ compiler component is missing? Jul 18, 2017 at 11:26
  • I'm running Ubuntu 16.04.2 LTS and I first installed gcc and after that I installed the cross-compiler toolchain mingw-w64. I also installed gobjc and gobjc++ package. Jul 18, 2017 at 11:43
  • Did you install gobjc++-mingw-w64? if not, try doing so Jul 18, 2017 at 11:53
  • It solved the error! Thanks :) Unfortunately there is now another error "fatal error: Foundation/Foundation.h: No such file or directory ", which refers to the standard foundation-header I import in my m file. Jul 18, 2017 at 12:18
  • I'd guess you'd need a full GNUStep toolchain to get that? Jul 18, 2017 at 13:47

1 Answer 1


You need to install the corresponding Objective-C++ cross compiler package, either from your favorite GUI package manager or via the command line using

sudo apt install gobjc++-mingw-w64

This should install both gobjc++-mingw-w64-i686 and gobjc++-mingw-w64-x86-64 allowing you to build Objective-C++ code targeting both 32-bit and 64-bit Windows platforms.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.