Меню Рубрики

Установка codeblocks на mac

How to install CodeBlocks on Mac?

Code::Blocks is a free, open source cross-platform IDE (Integrated Development Environment) which works alongside compilers such as GCC, Visual C++, and Clang. It is currently oriented towards just a few fundamental programming languages: C, C++, and Fortran.

CodeBlocks is supported by Windows, Mac OS X, and Linux. Its latest version, as of this writing, was released on Dec 27, 2013.

Now, introduction aside, I guess you already know what CodeBlocks is. You might have used it easily on Windows to write C/C++ programs; there it wasn’t much of a problem to use the IDE on Windows.

If you’re trying to get CodeBlocks up and running on Mac OS X, then there are few extra things you need to do besides downloading the CodeBlocks file. In this post, I’ll guide you through a step-by-step procedure to install CodeBlocks on Mac.

The Mac version of CodeBlocks relies on Xcode distribution from Apple for its compiler. So, the installation requires setting up of 3 different parts:

1. Installing Xcode:

The first thing you need to do is download Xcode from App Store. Just go to App Store, sign up if you need to, and search for Xcode. The file you’re looking for is this shown below; it is the first item in the search result.

The Xcode file is large – around 2.5GB. Here it says “open” because I’ve already installed it on my Mac. On your Mac, it may say “get” or “free” underneath the icon.

Just click on it, and install it, accepting all the defaults and entering your system password when required. The downloading and installation procedure may take some time. (The version I’ve installed is Xcode 6.1.1.)

2. Installing CodeBlocks:

In the second part, you need to download and setup CodeBlocks for Mac. Go to this page. Click on Download the binary release, and select Mac OS X. Then, download CodeBlocks from any of these two mirror links.

This is a zip file of around 30MB. Once you’ve downloaded it, upzip it and you’ll get a CodeBlocks app file. Now to install this, simply “drag and drop” that file into Applications folder.

If you’ve never installed an application on your Mac from a third-party site before, you will need to make a change to allow your system for such installations. For this go to System Preferences > Security & Privacy.

Click the lock to make changes, and click on Allow apps downloaded from: Anywhere as shown below. (You can revert to your original settings once you’ve installed CodeBlocks.)

3. Installing Command Line Tools:

After you’ve installed Xcode and CodeBlocks, there’s one more thing to do – installing the command line tools. If you just do the above two steps, you can write as much code as you want, but they won’t compile!

This is because you still don’t have a working GCC compiler on your Mac. Command Line Tools allow you to call the compilers from the command line.

Now, go to the Apple Developer download page. First, you may need to log in using your Apple ID, and then you may also be asked to sign up for Apple Developer ID which is free.

You’ll come across a page like this. Click on Command Line Tools for Xcode, and download the dmg file. (This file is 170MB as of now.)

Once you’ve downloaded it, you’ll get a package file (.pkg) as shown above. Just double-click it and it will install the Command Line Tools. Accept all defaults.

Then, everything’s set; you’re ready to write your first program using CodeBlocks on Mac. Open CodeBlocks, copy-paste this sample C++ code and click on Build and Run.

источник

Installing Code::Blocks from source on Mac OS X

These are instructions on how to build Code::Blocks under Apple Mac OS X. They have been tested under Mac OS X version 10.4 (PowerPC and Intel), and should work similarly on the newer Mac OS X 10.5 and 10.6 as well.

We will be building everything from scratch using the source code, and not use any available package managers like MacPorts, Fink, Gentoo or RPM. Packaging can be done later, once it has reached a more stable release.

Update: building for MacPorts can be found at the end of the document.

Contents

Install Developer Tools

If they didn’t come bundled with Mac OS X, get the Xcode Tools (or Developer Tools for older Mac OS X) from http://developer.apple.com/tools/ or from your install disk.

This will install Apple versions of:

Apple regularly pulls all older links in order to promote newer Mac OS X, but all the old developer tools can be downloaded from ADC at http://connect.apple.com/

You need a (free) developer registration with Apple first, in order to log in there. For Mac OS X 10.4, you want (at least) Xcode 2.2, since earlier versions were buggy.

Check Autotools versions

Depending on your OS version, you might need to download and compile new versions of these:

Check what you have, with --version (note that GNU libtool is called «glibtool» on Mac OS X)

Currently Code::Blocks requires versions:

  • autoconf 2.50+
  • automake 1.7+ (1.9+ needed in order to build the dist tarball)
  • libtool 1.4+ (1.5.8+ highly recommended to get some bug fixes)
Читайте также:  Установка приборки 2110 на 2109

Automake example

For Mac OS X 10.4, you will only need an upgraded (local) installation of automake 1.9.x.

You can download «automake-1.9.6.tar.gz» and configure and install it with something like:

Since it’s now known as «automake-1.9», it won’t interfere with the regular «automake»

If you would rather have the new version to be called when calling «automake», let it install into /usr/local and put /usr/local/bin before /usr/bin in your PATH.

Libtool example

Download libtool source. The following instructions will overwrite your current version of libtool with the one you just downloaded.

Note that this will replace the system version of glibtool, which might have some compatibility issues with building other software.

FYI: Universal Binaries

If you are building for Mac OS X 10.4 or later, you might want to build «Universal Binaries » These are binaries that contain code for both PowerPC («ppc» arch) and Intel («i386» arch)

The basic flags that needs to be added are:

(You only need the sysroot parameter on PowerPC Macintosh, not on a Intel Macintosh) The «-arch i386 -arch ppc» is what tells the compiler to build a «universal» (or «fat») binary.

Usually it’s easiest to build one version for «powerpc-apple-darwin8», and one version for «i686-apple-darwin8», and then merge them with «lipo»

  • pre-compiled headers might fail with a «no main» error. If they do, add a -c to only compile them
  • when cross-compiling, tools like auto_revision might fail to build. copy these from a native build
  • the Tiger compilers might crash from time to time, but that is only to be expected (it seems).

See Technical Note TN2137: Building Universal Binaries from «configure»-based Open Source Projects

FYI: Compilers

When building for older versions of the SDK, you want to make sure to use the same compiler.

Mac OS X 10.6 has GCC 4.2 as the default compiler, which won’t work for the Mac OS X 10.4 SDK.

FYI: ANSI or UNICODE

For the moment we are using «ANSI» (—disable-unicode, default) for Mac OS X 10.3 and earlier, and «UNICODE» (—enable-unicode, optional) for Mac OS X 10.4 and later.

FYI: 32-bit or 64-bit

Code::Blocks currently uses wxMac (wxOSX/Carbon), which is 32-bit only. So it’s not possible to build for «x86_64».

When Code::Blocks (and requirements) has been updated to use wxOSX/Cocoa, then a 64-bit version might be built too.

Build wxWidgets

Download the source code

Download the tarball for the wxMac release:

Apply necessary patches

Don’t forget to apply any released patches!

Configure and (GNU) Make

note: the easiest way to build a Universal Binary with wxWidgets is the new flag: —enable-universal_binary (you need wxWidgets 2.6.4+)

Install into Destination

Bundle library for Mac

To avoid having the Code::Blocks user having to compile or install wxWidgets themselves, we can bundle it with our application so that it is contained in the application bundle. This could also be done by statically linking wxWidgets, but with dynamic linking we can share the wxWidgets library between all applications using wxWidgets (not just Code::Blocks)

Way One: Library (dynamic)

To bundle our shared library with the application, we include it in «MacOS» and change the path:

@executable_path will be replaced with e.g. /Developer/Applications/CodeBlocks.app/Contents/MacOS

Way Two: Framework (bundle)

To bundle our framework with the application, we include it in «Frameworks» and change the path:

This way it will first look in the framework path (-F), and then in for the shared library path (-L) as usual.

Install Subversion client

On Mac OS X 10.4, you need to install the Subversion (svn) program:

Note: you need SVN for the Code::Blocks revision scripts to work!

Build CodeBlocks from SVN

Download the source code

Apply necessary patches

For a list of all available patches, see:

You might need to convert line endings from DOS to Unix first.

Bootstrap with Autotools

You need to use the newer version of automake (see above), for the «bootstrap». (OS X 10.5 users may have recent enough autotools so they may not need to install them)

Mono Fix

If you have the Mono.framework installed, then it probably set up a symlink like:

Unless you have a «proper» pkg-config installation the Code::Blocks configure will fail, so move this symbolic link aside.

Configure

Note: the easiest way to build a Universal Binary for Code::Blocks is to build once for PowerPC (-arch ppc) and once for Intel (-arch i386), and then merge them (with lipo) afterwards.

Note: You need to patch the location of the pre-compiled headers, or it will generate them in the same place for both arch.

Tiger Fix

There is a bug in the glibtool of Mac OS X 10.4, that fails to link C++ libs:

To work around this, you need to edit the generated «libtool» script manually:

This bug has been fixed in GNU libtool 1.5.8 and later.

(GNU) Make

«nice» isn’t strictly needed, it just makes the compile run at a lower process priority

For the Universal Binary build:

Install into Destination

«sudo» asks you for an admin password, in order to get install permissions

For the Universal Binary build:

Where «lipomerge» is a custom shell script:

Читайте также:  Установка головных устройств вао

Bundle application for Mac

After building codeblocks in the regular Unix way, you need to bundle it with the icons and various other info that it needs to make a regular stand-alone Macintosh application.

There are two ways of accomplishing this, old Mac OS-style resource or NeXT-style bundle. The old resources are handy while developing, while bundles are more suitable for release.

Note: You need to use either of these methods, or your application will launch in the background behind all other windows and will be unable to receive any events!

Way One: Mac OS (resource)

Handy while developing, as you don’t need to create a whole bundle.

First we install the program to the PREFIX directory of your choice:

Note: on the Intel Macintoshes, the icon comes up as «broken» (apparently it assumes that all apps with resforks are Classic)

Start the application with a small prefix shell wrapper like this:

You don’t need the «DYLD_LIBRARY_PATH» stuff, if you are installing to a system directory.

Common PREFIX Settings

Way Two: NeXT (bundle)

This does not involve resources, and is more relocatable.

  • codeblocks.plist (generated, rename to «Info.plist»)
  • codeblocks.sh (shell wrapper, rename to «CodeBlocks»)
  • app.icns (icons are available in src/src/resources/icons)

The MacOS program will just be a shell wrapper that calls «bin/codeblocks», like above. Traditionally the bundle would include Frameworks and Resources, but we’ll just avoid those here and use the regular «lib» and «share/codeblocks» instead (just as with a regular install). These temporary directories are listed in italic below, they’re not really used in bundles.

Setup a hierarchy like this, and copy the files from the regular build/install and the above file list to it:

The CodeBlocks application can now be moved with the Finder, and started up like a regular Mac application. (the nightly build includes a more advanced Info.plist and more icons — for also mapping all the files that the application can open, like source code and header files and such)

Proper Application Bundling

To avoid the shell wrapper, the binary can now be moved from «bin/codeblocks» to «MacOS/CodeBlocks». Helper files are moved from «share/codeblocks» to «Resources». The dynamic libraries are moved from «lib» to «MacOS»:

To avoid having to use a DYLD_LIBRARY_PATH, we rename the shared libraries (with the install_name_tool program) from e.g. /usr/local/lib/ to @executable_path/:

The libraries can have their names changed using the -id parameter:

You also need to change all of the loadable bundles for the plugins:

You can check the result, what libraries/frameworks it links to, with:

Optionally you can then repeat the process, for the wx library too.

Here is a full script to do the job. It assumes to be executed at the same directory level as the CodeBlockSVN.app directory that will receive all the stuff. maybe enhanced but it is a first try that do work when packaging an OS X SVN build.

FYI: Darwin vs. Mac OS X

«Darwin is the UNIX technology-based foundation of Mac OS X.»

«Pure Darwin» here refers to the Open Source version of the OS:

(that is: Darwin using X11 instead of Aqua for the user interface)

Install with MacPorts

Install wxWidgets

You will need the wxWidgets library, install as port with:

If you want the X11/GTK version on Mac OS X, instead use:

Install Code::Blocks

After that is installed, you can install Code::Blocks with:

If you want the X11/GTK version on Mac OS X, instead use:

This will download the SVN trunk, and any dependencies:

Note: to upgrade from SVN, you need to uninstall first:

This is both because all SVN versions are numbered «0», but also due to a bug in the Code::Blocks build scripts.

Running +aqua (wxMac) version

After the build completes, you can start the program by:

Note that the wxMac application bundle in «MacPorts» is just a wrapper, with symbolic links to /opt/local.

Running +x11 (wxGTK) version

The non-bundled wxGTK version is instead started with:

When running X11/wxGTK programs in Mac OS X, you can use «open-x11» to first start up X11.app and set up $DISPLAY:

источник

How to Install C++ Code::Blocks in Macintosh

C++ For Dummies, 7th Edition

The Macintosh version of Code::Blocks for C++ relies on the Xcode distribution from Apple for its compiler. The installation is done in three separate parts for this reason.

Installing Xcode

Xcode is a free development package offered by Apple that you will need. Follow these steps to install it first:

Open the Safari browser and go to the Apple Developer site.

Click on Download Xcode to get the most recent version.

This will open the Xcode download dialog box shown in this figure

Click on the Free icon to change it to Install App. Click on it again.

Enter your system password (the one you log in with when your Mac boots up).

The icon changes to Installing.

The download and installation takes quite some time, as Xcode is a little over 2GB as of this writing.

Installing the Command Line Tools

As big as Xcode is, you would think that it has everything you need, but you would be wrong. You need one more package from Apple to make your joy complete and to get a working gcc compiler on your Macintosh. Follow these steps to install the Command Line Tools for Xcode:

Читайте также:  Установка oracle jdbc driver

Open the Safari browser and go to Apple Developer download website.

You may be asked to sign up for an Apple Developer ID. Go ahead and do so — it’s free.

Search for Command Line Tools for Xcode. Select the application shown in the following figure. Click on the Download icon.

Double-click on the mpkg package that downloads to install it.

Accept all of the default values.

The installation should finish with Installation Was Successful.

Installing Code::Blocks

Now, you can finish your installation by downloading the Code::Blocks editor:

Open the Safari browser and go to Code::Blocks Downloads page.

Click on Downloads→Binaries.

Select either the BerliOS or Sourceforge.net mirror for the most recent version.

At the time of this writing, CodeBlocks-13.12 -mac.zip was the most recent.

Install the downloaded Zip file into the Applications folder.

If you have never installed an application from a third-party site, you may need to execute these extra steps before you can do so:

Click on System Preferences.

Click on Security and Privacy.

Click the padlock in the lower-left corner of the dialog box to allow changes.

Click on Allow Applications Downloaded from: Anywhere, as shown in the following figure.

Once you have completed the installation of Code::Blocks, you may choose to return to this dialog box and restore the settings to Mac App Store.

Double-click on the Code::Blocks icon.

The first time you do this, the Mac OS will ask, “Are you sure you want to open it?”

Select Don’t Warn Me When Opening Applications on This Disk Image and click Open.

Code::Blocks should start and find the gcc compiler installed with the Command Line Tools.

Select the gcc compiler, as shown in the following figure. Click on Set as Default and then click on OK to continue starting Code::Blocks.

Code::Blocks will open with a banner page followed by a menu across the top of the dialog box.

Select Settings→Compiler, then click the Have g++ Follow the Coming C++0x ISO C++ Language Standard. Click on OK to close the dialog box.

You are now ready to build your first C++ program.

источник

Установка Boost с CodeBlocks на Mac

Я пытаюсь найти инструкции по установке библиотек Boost с кодовыми блоками на Mac. В частности, мне просто нужно использовать библиотеку духов Boost. Веб-страница CodeBlocks дает инструкции для Windows в http://wiki.codeblocks.org/index.php?название=BoostWindowsQuickRef . Я пытался найти аналогичные инструкции для Mac, но не смог этого сделать. У кого-нибудь есть указатели?

2 Ответа

Я не очень много знаю о духе, но мне кажется, что вы можете просто поместить файлы в свой каталог include. (как я сделал это со всей библиотекой boost на моей машине windows)

Дух является заголовочным файлом только библиотеки. Нет библиотек, на которые можно было бы ссылаться

Это действительно означает, что вам нужно только указать расположение заголовков, И вы можете идти.

Обратите внимание, что то же самое касается всех реквизитов из Boost: Phoenix, Proto, Fusion, Mpl, Typetraits, Utility-это только заголовок

Наконец, вы можете создать подмножество boost, которое соответствует тому, что вы используете. E.g. to ‘excise’ подмножество для

на моей системе я мог бы сделать

что приводит к 2757 файлам (всего

Похожие вопросы:

Я следую этому руководству, чтобы установить Boost на Windows XP под управлением CodeBlocks: http://wiki.codeblocks.org/index.php?название=BoostWindowsQuickRef . Я скачал Boost и BoostJam и версии.

Я пытаюсь установить PyMaxflow на Mac (Mavericks), который требует boost. У меня установлен boost с homebrew, но файл сборки все еще не может его найти. Есть мысли? In file included from.

Я не очень большой программист c++, просто конечный пользователь, пытающийся установить существующий проект из исходного кода. Одной из зависимостей проекта является библиотека boost. Когда я.

Я пытался установить PyGMO на моем Mac OS X 10.10. Я использую Anaconda Python 2.3 , поэтому он поставляется с python 3.4 . Я следовал инструкциям на http://esa.github.io/pygmo/install.html и.

Недавно я переключился с Windows на Mac . Мне сказали, что в Xcode включены библиотеки C/C++(GCC). Судя по всему, новый Xcode 5 его нет. Как IDE, я скачал CodeBlocks. Как установить библиотеки для.

У меня есть код C++, который зависит от boost и других библиотек, и поэтому этот код имеет makefile, который вызывает boost. Сейчас я пытаюсь начать разработку этого кода в codeblocks в linux.

Недавно я начал работать с Boost на Windows для одного проекта. Он должен быть кроссплатформенным, поэтому я также установил его на Mac. К сожалению, всякий раз, когда я добавляю его в проект Xcode.

Итак, я здесь почти в конце своей строки; я искал сохранение файлов и сериализацию, только чтобы узнать, что C++ не имеет такой врожденной способности сериализации, как Python с его замечательным.

В настоящее время я работаю над проектом, который мне поручили. Я собираюсь запрограммировать шлюз (также известный как маршрутизатор). У меня есть виртуальная установка с 3 виртуальными машинами (3.

Я новичок с CodeBlocks на Mac OS, и у меня есть проблема с использованием отладчика. Когда я пытаюсь использовать его, у меня есть это сообщение об ошибке отладчика: ERROR: вам нужно указать.

источник

Добавить комментарий

Adblock
detector