How To Compile A Library C++ Mac

Compile library in Mac I am looking for a developer who can build CxImage on Mac, and provide all binary files (like.lib in windows) for both debug and release in Mac Skills: C Programming, Mac OS, Objective C, Software Architecture, Windows Desktop.

This is how we compile otclient on Mac OS X, we use XQuartz to compile and run otclient, which is an X11 implementation for Mac OS, we do not use the native Cocoa API. This means that users will need XQuartz installed too to run the client. You will need to know the basics of how using the terminal in Mac OS to follow this tutorial.

Sep 27, 2017  On other distributions, you may need to install the GNU C compiler separately. The package is going to have c or g in its name. If you can't find the equivalent of build-essential meta-package for your distribution, be sure to install the 'make'. In this case, 'clang' is the driver that causes the Clang compiler to expect C code and link against the C standard library. The args array specifies the command-line arguments that will be passed to clang. These arguments must be specified in the order expected by the compiler.

Requirements

  • Mac OS X 10.6 or higher
  • Command Line Tools for Xcode (install them inside the XCode menu)

You should install all those requirements first, in order, I will not cover how to install them in this tutorial.

Installing needed libraries

We use brew to install most of the required libraries by using the following commands:

How to compile c++ in terminal

Cloning and compiling

You may need to change the included directory of your installed version of OpenSSL. Check your installed version with brew info openssl. If it is not version 1.0.2.n, change the version in the cmake command below.

Now you can run, the otclient output binary should be in the same directory.

Clone this wiki locally

Building on Linux

Prerequisites

All requisites should be available for your distribution. The most important are:

  • The basic program build tools. On Ubuntu and Debian these are available in the meta-package build-essential. On other distributions, you may need to install the GNU C++ compiler separately. The package is going to have c++ or g++ in its name. If you can't find the equivalent of build-essential meta-package for your distribution, be sure to install the 'make' utility as well.
  • CMake, the cross platform build system.
  • Qt version 4.4.0 or higher (but Qt version 5.x won't work). If you have KDE 4.1 or later installed then you will have the runtime libraries but you may have to install the header files and utilities. These are in the package libqt4-dev on Ubuntu and Debian. Generally, developer packages have the -dev or -devel suffix.
  • Several more developer packages:

These are the package names on Debian and Ubuntu, find the similar ones for your distribution. For Fedora, use '-devel' instead of '-dev' as suffix and drop the version numbers.

PackageVersionPossible Package Names
libjpeganylibjpeg62-dev
Fedora: libjpeg-turbo-devel
zlibanyzlib1g-dev
libpnganylibpng12-dev
libtiffanylibtiff4-dev
libboost>= 1.35libboost1.40-all-dev
boost-libs
(if that fails, try: libboost1.55-all-dev)
libxrenderanylibxrender-dev
libXrender-devel

Configuration

Open a console window and go to the directory that contains the scantailor sources. From there, run the following (notice the dot at the end):

There will be lots of messages from cmake ending with:

  • If you have missing dependencies you will get an error message telling you what is missing. You can then search for the missing package and install it.
  • If you have a library and header files installed in a non-standard place then cmake will not find them. In that case you can run the interactive program ''ccmake'' which allows you to specify paths to libraries and header files.

Compilation and Installation

Building on Mac OS X

MacPorts

MacPorts has already scantailor as a package(Xcode prerequisites for MacPorts apply)

Building on Mac OS X is very similar to building on Linux but the package names are different and the MacPorts packaging system needs to be installed in order to get the needed packages. Also the nonstandard location that MacPorts installs qmake to needs to be specified.

How To Compile A Library C++ Macbook

Prerequisites

  • Xcode. Install it either from your Mac OS X install media or better, go download the latest version from http://developer.apple.com/TOOLS/Xcode/
  • MacPorts. Choose and install the correct dmg version for your version of Mac OS X from http://www.macports.org/install.php, then open a Terminal window and run:
  • Then install the rest of the needed packages with

This installs:

Compile C Code On Windows

  • CMake, the cross platform build system.
  • Qt version 4.6.0 beta currently
  • Boost version 1.40.0 including libboost
  • libxrender

The rest of the needed packages are installed as dependencies of these.

How To Compile C++ On Windows

Configuration

C Compiler For Mac

Download the scantailor source code package and then upack the source by entering the following in the directory where the source package resides:

Replace the file name above with the name of the version that you have downloaded. Typing the first few letters of the name and typing tab will autocomplete the filename for you.

Then navigate to the directory that contains the scantailor sources. From there, run the following (single line and mind the dot at the end):

There will be lots of messages from cmake ending with

  • If you have missing dependencies you will get an error message telling you what is missing. You can then search for the missing package and install it.
  • If you have a library and header files installed in a non-standard place then cmake will not find them. In that case you can specify them as above for qmake or run the interactive program ''ccmake'' which allows you to specify paths to libraries and header files.

Compilation and Installation