compiling Objective-C program on Windows - objective-c

A friend sent me 4 files (two .m files, one .pch file, and one .h file) that he says compile together into an Objective-C program. From what I understand, it's an Apple language, and I use Windows. I've been trying to compile it in a new project on Dev-C++, but haven't had any luck. After some research, I downloaded a special Objective-C library for it and selected "Yes" under "Link an Objective C program," but am getting a build error when I try to compile it.
The code uses Cocoa, but according to my friend, it will work the same in Windows if I import Foundation.h instead of Cocoa.h. I found a tutorial on how to compile Objective-C programs in Windows here, but I don't understand step 2 (which is "Set environment variable for GCC compiler (C:\GNUstep\mingw\bin\gcc.exe)") since that file doesn't exist on my computer. When I follow the compilation instructions, I get this error: sh: gcc: command not found. If possible, I'd rather compile it in a GUI-based compiler, as I hate working with command prompts.
Any help with compiling these files on any program is greatly appreciated!

Time to cowboy up, and learn some command line compiling.
First, you need to install the GNUStep on your machine.
Then, set the appropriate environment variable to point to whereever you installed GNUStep to.
Now you should be able to finish the tutorial.
GNUStep is designed to let developers build cocoa applications on a variety of platforms.

Environment variables are named strings that exist for all processes in Windows. If you open a cmd window and enter the command SET you will see a list of all the currently defined environment variables.
On Windows XP, add a new one by right clicking My Computer and selecting properties. Then hit the advanced tab and click on the environment variables button at the bottom. You can either add the variable for just you or for all users on the system.
I don't know how to set environment variables for later versions of Windows but I expect Google might have some useful links.
From some of your comments, it is clear you haven't installed GNUStep in the same place as the instructions. Just do a file search for gcc.exe to find out where you have installed it.

Related

How to get VB.NET for Mono set up?

I'm trying to get a Mono development environment set up on a Windows box. Basic install was dead simple, but I'd like to get the VB.NET compiler set up. Only problem is, there doesn't seem to be an installer for it. The official page on VB.NET support implies that there should be, but there isn't; it hasn't been incorporated into the main installer, either. I can download the source package from the mono-basic Github, but since the compiler is self-hosting, that just leaves me in a catch-22 situation where I need the compiler to compile the compiler... :/ On top of which, it doesn't look like the compiler code has been touched in a couple years...is this still supported? Is there any way to get it set up apart from doing a build from source on a machine with the official VS toolchain (or a Linux box with the package installed from a repository) and then copying it over?

Provide multiple toolchain options in CMake

I have an embedded project for ARM platform, specifically aarch64.
Up until now I was using Make. I recently set up CMake with no particular issues.
I moved to CMake because I was under the impression it was a more modern build tool that would have allowed a smarter configuration.
For example, I can compile my project using different toolchains (aarch64-elf-gcc-linaro, aarch64-linux-gnu-gcc,...) and I would like CMake to try if any of those are installed on the system and use whichever is found first by default.
Is this possible (or meant to)? I'd expect it to be an easy feat for the tool, but after searching for a while I can't seem to find the right track.
Yes, you can make your CMake project to search for available tool-chains installed in your OS, choose one and compile your project. I also write a CMake program for ARM embedded project, because now it is universal transferable between different OS system Windows and Unix. On Linux there is ARM ToolChain installed and on Windows there is Keil-MDK. If you have different tool-chains to choose between, you can write CMake script which will find paths with command like find_path() and then call correct "toolchianxx.cmake" script with right compiler flags for chosen compiler.
In your particular problem just use find_path commands and use hits to find installed compilers in "pre-set" known paths.

Problems with cygwin build dll for use in windows app

I use Cygwin to build source code to DLL used by windows app.
When I use GCC core / GCC g++, the app crash if it calls function (which includes printf or malloc) in DLL.
When I use Mingw64-x86_64-gcc-core / Mingw64-x86_64-gcc-g++ it reports error like sys/socket.h:No such file or directory.
Can anyone explain how to do it? Thanks.
The first problem is due to the tentative to build a stand alone DLL (not depending on cygwin1.dll) using cygwin only specific tools.
You have collision between multiple malloc and other C library call present in cygwin1.dll.
The second is due to the fact that sys/socket.h does not exist on Windows
see for possible solution:
Using sys/socket.h functions on windows
So you need to define what is your target : Cygwin/Posix or Windows and choose programming style and tools accordingly, you can not mix.

How do I execute a command-line application built with Xcode?

I'm building a small command-line utility (not an app) with xcode. All I want to do is the equivalent of a gcc -o name, and I'm completely stumped. I can compile just fine in xcode, and execute the result inside of xcode, but I can't for the life of me find the executable image anywhere on the disk. There's nothing at all executable in the .../DerivedData folder, for example. How do I tell Xcode to create a stand-alone executable image (that I can launch from a Terminal window) and put it in a known location?
Found the answer. When you select the Product for the application, make sure that the application is set to Unix Executable (it defaults to something else). The full path to the product is displayed further down in the dialog.

Mac server in order to compile obj-c projects?

Is it possible to write an obj-C code with any text editor and then upload it to Mac server to compile it using Xcode??
I know that it is possible to compile your project using Xcode without open it something like use some command lines, but I am not sure is it possible to make it a server and then upload any obj-c code!
You can compile your projects from the command line using the xcodebuild command. Automating your builds is another story altogether: you'll need to set up your server to download the updated source code (typically via version control, e.g. svn update or p4 sync), do the build, and then upload the builds results somehwere (e.g. check into version control).
Doing this is non-trivial, and there's a lot of software out there, such as FinalBuilder, to help make this easier, although FinalBuilder is Windows software so probably isn't what you want.