Search code examples
objective-cgnustep

Gcc error trying to compile GNUstep objective-c on Windows


  1. I have installed the four GNU packages (GNUstep MSYS System first, GNUstep core second, GNUstep Devel and finally Cairo Backend) into my C drive (I am using it on Windows).

  2. I have created the directory E: /MyProject/ObjectiveC into which I wrote my Helloworld.m program and saved it.

  3. I used the command " $ gcc 'gnustep-config --objc-flags' helloworld.m -o helloworld 'gnustep-config --base-libs' to compile the program but I am getting the following error (Screenshot cannot be provided due to less than 10 reputation)

    a) gcc.exe: error: gnustep-config --objc-flags: No such file or directory

    b) gcc.exe: error: gnustep-config --base-libs: No such file or directory

Is there anything I have been missing? Do I have to create a makefile in the objectivec directory?


Solution

  • I think the problem is you have used normal quotes instead of back-quotes. On a standard US English QWERTY keyboard, the back-quote is to the left of the number 1 key.

    Normal quotes tell the shell not to interpret special characters, and space is a special character. So the shell is passing gnustep-config --objc-flags to gcc.exe as a single command-line argument containing a space.

    Back-quotes tell the shell to run the text between the quotes as a command, and to replace the quotes and command by the output of the command. So in this case, if you use back-quotes, the shell will run gnustep-config --objc-flags as a command. Presumably the config command prints out the compiler flags required to compile GNUstep Objective-C source code. Then the shell puts those flags on the gcc command line, replacing the quoted command.