How to create a desktop shortcut in MAC OSX using C++ only.
in linux i can do by using .desktop file
[Desktop Entry] Version=1.0 Name=Eclipse Exec=/usr/local/bin/eclipse How to create a desktop shortcut in MAC OSX using C++ only.
in linux i can do by using .desktop file
[Desktop Entry] Version=1.0 Name=Eclipse Exec=/usr/local/bin/eclipse As has been mentioned, by @dreamlax, it's an alias that you would be creating; at least, this is what the UI provides when you right-click on an item: -

If you use the terminal and create a symbolic link to an item on the desktop, you'll see that it creates a similar 'alias'. So what you could do is create a symbolic link to the source item with a call to the ln function, which may be the same as the symlink function call.
Note that the alias created with the UI is not exactly the same as that created by ln, as you can see when linking to a pkg (installer) file. if you use the 'file' command on the two. Using ln, the created link is identified as "xar archive - version 1", whereas the UI alias creates a file which is "alias: data".
However, as far as functionality goes, both should work as a way of placing a link on the desktop to an item in another location.
Finally, take note of this distinction between the POSIX ln and alias before deciding if ln is suitable for your situation: -
[alias] is similar to the Unix symbolic link, but with the distinction of working even if the target file moves to another location on the same disk
If you want to make an alias, have a look at the Alias Manager reference, or if you are targeting 10.8 or later, you can use CFURLCreateBookmarkData instead.
In fact, you may even be able to just use the POSIX symlink to create a shortcut. Try that first and if that suffices, don't bother with the more complicated Alias Manager or CFURLCreateBookmarkData.
Here is the C code required to create a bookmark (you'll need to specify -framework CoreFoundation to the command line flags for the compiler if you are compiling from the command line, or otherwise add the CoreFoundation framework to your project in Xcode).
CFErrorRef error = NULL; CFURLRef aliasFile = CFURLCreateWithString(NULL, CFSTR("file:///Users/msl/Desktop/Terminal%20Alias"), NULL); CFURLRef targetFile = CFURLCreateWithString(NULL, CFSTR("file:///Applications/Utilities/Terminal.app"), NULL); CFDataRef bookmark = CFURLCreateBookmarkData(NULL, targetFile, kCFURLBookmarkCreationSuitableForBookmarkFile, NULL, NULL, &error); if (bookmark == NULL) { // something went wrong, check what "error" variable says } Boolean success = CFURLWriteBookmarkDataToFile(bookmark, aliasFile, kCFURLBookmarkCreationSuitableForBookmarkFile, &error); if (!success) { // something went wrong, check what "error" variable says } // make sure to clean up if (bookmark) CFRelease(bookmark); if (aliasFile) CFRelease(aliasFile); if (targetFile) CFRelease(targetFile); CFURLCreateBookmarkData has anything to do with this?CFURLCreateBookmarkData, which contains the the target to link to, and then write the bookmark data to a file using CFURLWriteBookmarkDataToFile to create the actual alias.Hold Shift key, and drag application to target location. e.g: Desktop.