Меню Рубрики

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

Установка и настройка Code::blocks на Banana Pi, Orange PI и Raspberry Pi под Ubuntu

Установка Code::Blocks >

В дальнейшем, для работы с WiringPi на языке C/C++, нам нужен будет IDE. Так как я не люблю писать в блокнот и потом компилировать всё это в терминале, мы установим Code::Blocks IDE.
И так, для начала необходимо установить компилятор gcc и g++. Как правило, оба компилятора уже установлены разработчиками ОС Ubuntu. А если их на вашей ОС нема, тогда установите оба компилятора так:

С этими компиляторами можно компилировать программы в консоли, также ими пользуются среды программирования такие как Code::blocks.
Code::blocks тоже можно установить через терминал:

Создание нового проекта WiringPi в Code::blocks и его настройка

Похожие записи

Комментарии 9

cannot find -l -lwiringPi
cannot find -l -lpthread
как решить эти ошибки ?

Добавлять нужно не в поле libraryes а в поле linker options

cannot find -l -lwiringPi — нужно установить wiringPi
cannot find -l -lpthread — нужно установить gcc, это часть его

Как подружить Code::Blocks IDE с русскими буквами ? Земетил переодическое завершение программы из-за наличия русских символов в коде(вывод на lcd) или коментариях .

Я думаю, что это баг Code::Blocks, у меня такая-же проблема, по этому я перешёл на CodeLite, не такой удобный, но не вылетает внезапно

Это работает:
sudo gcc main.cpp -o blink -lwiringPi -lpthread

А кодблокс не работает:
ld cannot find -l -lwiringPi
ld cannot find -l -lpthread

Goto Settings->Compiler and Debbuger, Choose Linker settings tab.
In Link libraries click add and choose «/usr/lib/libwiringPi.so

Чё-т Code::blocks не хочет ставиться

Какие ошибки/сообщения выдаёт при установке, какая операционная система у вас стоит, на какой плате.

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

We are using cookies to give you the best experience on our website.

You can find out more about which cookies we are using or switch them off in settings .

Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

Strictly Necessary Cookies

Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.

If you disable this cookie, we will not be able to save your preferences. This means that every time you visit this website you will need to enable or disable cookies again.

источник

Installing Code::Blocks from source on RPM based distributions

Contents

Install Requirements

Note: Code::Blocks requires GTK+ 2.x. Older distributions might only support GTK+ 1.x.

Upgrading GTK+ is beyond the scope of this document, easier to upgrade distribution ?

Install Development Tools

This has to be installed before starting:

  • zip
  • update-desktop-files (only on SUSE)
  • make
  • gettext
  • autoconf >= 2.5
  • automake >= 1.7
  • libtool >= 1.4
  • m4
  • intltool
  • gcc-c++
  • libstdc++-devel

In Fedora/CentOS, this can be done with:

Install newer autotools versions (if needed)

If you have CentOS 3 or RHEL 3, you will need to rebuild «automake17» to use instead of automake-1.6:

Then you need to invoke bootstrap like this, both on the commandline and in codeblocks.spec:

Setup RPM environment

This has to be installed before starting:

The top work directory for RPM varies between distributions and setups, but you can find your RPM top dir by setting a variable like:

Non-root rpmbuild environment (recommended)

It is recommended that you don’t use the root account to build packages, here is how you set up a minimal user build environment:

You can now build packages without being root (assuming that the spec files are correct). You will still need root access to install.

Install wxWidgets 2.6.x

Note: the following section on the required version is out of date; please do use from the 2.8 branch.

The build requirements in the source RPM are set to a minimum. So it isn’t checked whether wxGTK is installed or not. So you have to take a look at it yourself. Note that currently Code::Blocks requires wxWidgets 2.6, not 2.8! So if your distribution only provides packages for wxWidgets 2.8, you need to build wxWidgets 2.6 yourself.

  1. wxGTK >= 2.6.0 and its devel package (see wxwidgets.org)
  2. wxGTK-xrc and its devel package (in some distributions included in the packages of point 1)

In later Fedora, this can be done with:

Build the wxGTK RPM from source (if needed)

  • wx-base-unicode-2.6.3.0.2-1.i386.rpm
  • wx-base-unicode-devel-2.6.3.0.2-1.i386.rpm
  • wx-gtk2-unicode-2.6.3.0.2-1.i386.rpm
  • wx-gtk2-unicode-devel-2.6.3.0.2-1.i386.rpm
  • wx-gtk2-unicode-gl-2.6.3.0.2-1.i386.rpm
  • wx-gtk2-unicode-contrib-2.6.3.0.2-1.i386.rpm
  • wx-gtk2-unicode-contrib-devel-2.6.3.0.2-1.i386.rpm
  • wx-gtk2-unicode-debuginfo-2.6.3.0.2-1.i386.rpm
  • wx-i18n-2.6.3.0.2-1.i386.rpm

Install Subversion client

This has to be installed before starting:

Binary packages for Red Hat Linux 9, Fedora Core 1, CentOS 3, CentOS 4 at:

In later Fedora, this can be done with:

Читайте также:  Установка 90 амперного генератора на уаз

Build Subversion RPM from source (if needed)

  • subversion-1.4.2-1.i386.rpm
  • subversion-devel-1.4.2-1.i386.rpm
  • subversion-perl-1.4.2-1.i386.rpm
  • subversion-python-1.4.2-1.i386.rpm
  • subversion-tools-1.4.2-1.i386.rpm
  • subversion-debuginfo-1.4.2-1.i386.rpm

Install Code::Blocks

Download the Source RPM

Note: SRPM’s are for the last stable (10.05); the SVN branch includes the many improvements since then.

Prepare SRPM package from SVN (if needed)

1. You need to get the latest sources from SVN www.codeblocks.org/downloads/svn

2. go into trunk, if you haven’t already done it.

3. run these three commands in this order

the last one will create a .tar.gz archive that contains the sources.

4. copy the archive to the directory $RPM_TOPDIR/SOURCES

5. build the source RPM, or copy spec to $RPM_TOPDIR/SPECS

This will create a source package in the directory $RPM_TOPDIR/SRPMS/.

Build the RPM package

1. Build the binary package

This will create several packages in one of the architecture specific subdirectories (i386, x86_64, ppc, . ) of $RPM_TOPDIR/RPMS/.

  • codeblocks: main package
  • codeblocks-contrib: contrib plugins
  • codeblocks-devel: SDK headers
  • codeblocks-contrib-devel: headers for contrib-plugins (wxSmith etc.)
  • codeblocks-debuginfo: stripped debug information

Install the RPM package

Install as root the packages you want (usually codeblocks and codeblocks-contrib) and enjoy Code::Blocks!

источник

Installing Code::Blocks from source on Linux

These are instructions on how to build Code::Blocks under Linux. These instructions should work for all Linux distros, as we’ll be installing from sources.

Contents

Prerequisites

In order to successfully compile Code::Blocks, the wxWidgets User Interface library must be installed. For most Linux users, this is maybe the only dependency not already installed. wxWidget can be used directly on top of the X server, in this case the variant of the wxWidget library is called wxX11. However this library is sub-par compared to other toolkits and unstable. Hence Code::Blocks uses wxGTK, the version of wxWidget based on GTK+. The exact requirement is libwxGTK-2.8.0 or later (2.8.3 is not recommended because of some troubles). This creates an additional dependency on GTK+, consider the following:

A possible implementation which does not exist:

Code::Blocks -> xwWidget (libwxX11) -> X

Current Code::Blocks implementation:

Code::Blocks -> xwWidget (> libwxGTK2.8) -> GTK+ (> libgtk-x11-2.0) -> X

This document helps you to install libwxGTK if necessary but does not cover the installation of GTK+. GTK+ is probably installed on your Linux anyway, so don’t worry 😉

Note: All the instructions below, assume an existing directory named

/devel. If you ‘ll be using a different one, adjust the path to match. As a first step create this directory:

Checking the presence of GTK+ library

Have a look in /usr/lib ( /usr/lib/x86_64-linux-gnu for 64 bits) for something like «libgtk-x11-2.0.so» (Note the library must be 2.0 minimum). Alternatively, do a search with your package manager or go to your Linux distribution forum for help. If you don’t want to loose time, you can even forget this check since there is a good probability that everything is already installed.

Library wxGTK installation

Checking the presence of libwxGTK library

In your package manager, look for ‘libwxgtk’ keyword and verify that all libwxgtk2.8 stuffs are installed. If you find the libraries uninstalled, just install them and go directly to Code::Blocks installation.

Alternatively you can do the same in the command line (the following is an example, there may be more than two packages):

If you don’t find any packages you must install the library from source as described below, and you can redo this check afterwards to verify that the installation worked correctly.

Note for Debian and Ubuntu users: You can use

to see which version of libwx is there or not and currently active.

And, Debian and Ubuntu user can use this to add a value to the list of choices

Getting wxGTK sources

Visit the wxWidgets web site. Click the «Download» button at the top of the page. Under wxWidgets 2.8.7 downloads, select wxGTK. Save the file in

/devel. After the download finishes, switch to

Now, untar the wxGTK sources:

Switch to the wxGTK directory:

Building wxWidgets

Here we will create a separate build directory instead of building from the src directory, so that we can easily rebuild with different options (unicode / ansi, monolithic / many libs, etc).

The documentation says the default is for gtk2 to use unicode and wx > 2.5 to build as a monolithic library. This doesn’t appear to be the case, so these flags are passed to configure:

Add /opt/wx/2.8/bin to the PATH (if your shell is bash then edit /etc/profile or

/.bash_profile) (On Suse 10.1 edit /etc/profile.local, it will only be available after a new login). An example PATH:

Add /opt/wx/2.8/lib to /etc/ld.so.conf (nano /etc/ld.so.conf), then run:

That’s it. Now the linker will look in /opt/wx/2.8/lib for wx libraries and you will have a monolithic shared library unicode build.

To check that things are working, type:

which should give you /opt/wx/2.8

which should have at least:

Читайте также:  Установка подогрева сидения на снегоход

but can contain other flags as well.

should return /opt/wx/2.8/bin/wx-config

Code::Blocks installation

Getting Code::Blocks sources

You can get Code::Blocks source code from the website as a tarball or from the SVN repository (this second method is described below).

From SVN repository

NOTICE: The SourceForge CVS is no longer used although it still exists.

Enter your development directory:

Then checkout the source using one of these methods. This will create the directory trunk. Change to the source code directory, by issuing the following command:

If you are a Gentoo user at this point, please see Compiling_Code::Blocks_in_Gentoo.

Before beginning, it is often a good idea to check you have recent versions of autoconf and automake — repositories versions are not always recent enough. (if you do not have automake, then you will get «cannot find aclocal» error). If you’re compiling the svn trunk versions of CodeBlocks (or future versions) then the unix build has switched to autotools. So first build wxWidgets as described above and then build CodeBlocks. In short, these commands build Code::Blocks from sources and installs it:

The long story is as follows: First run:

This sets up the configure script and its dependencies. It only needs to be run once (after downloading the source from svn).

. then install the «libtool» package using your package manager.

. then the «autoconf» and «automake» package using your package manager.

. then there exists a problem with DOS line-endings, for example if you cross compile to a Windows partition. Simply check-out a fresh copy of CodeBlocks from SVN.
Or, instead of downloading from SVN, you might consider using the little command line tool dos2unix, which normally comes with most distributions.

. (configure aborts with some unspecific error messagelike that), then you might consider also running dos2unix bootstrap acinclude.m4 codeblocks.pc.in configure.in Makefile.am before running bootstrap. Once you’ve run the bootstrap script, jump to next step.

. then aclocal is having trouble finding the wxWidgets .m4 files. You can do one of two things: To just get bootstrap to find the path this time do:

To change the aclocal search path more permanently do:

Then aclocal will also search somewhere like /opt/wx/2.8/share/aclocal

Note for Ubuntu users: The above is not the correct way to fix the AM_* errors. Rather, you only need to install the package named «wx-common» (Universe repository).

. then this can be solved by something like:

(. maybe adopting the path, so use `wx-config —prefix` is necessary.)

Installing Code::Blocks sources

You can read the BUILD file included in the source, but everything is very straightforward. Do:

You may need to run make install with super user rights, in that case use:

If you have multiple versions of wxWidgets installed or kept them in place, you can use:

Note: The Nassi Shneiderman plugin (part of the contrib plugins) has a dependency on boost which is needed to compile this plugin. Boost does not need to be compiled therefore. It is not checked for the existing of boost at the moment (except for debian build-system, there it is a build-dependency), so if you configure C::B to be build without Nassi Schneiderman, it should not lead to problems in case you don’t have/want boost.

To uninstall you can later run:

If you want to recompile everything, first run:

and then follow the above sequence for installing.

By default, CodeBlocks will install to /usr/local. If you want it in its own tree (so you can have multiple versions of CodeBlocks, each in its own subdirectory of /opt) replace the above ./configure command with:

or similar. Then you can later install a different build like:

followed by ‘make && make install’ as usual.

By default, CodeBlocks will not compile the contributed plugins from SVN. If you want to compile / install them too, replace the above ./configure command with:

followed by ‘make && make install’ as usual.

To see a list of other options available for configuring the build of CodeBlocks do:

To compile under Gentoo, use:

Resolving runtime issues

When running Code::Blocks after the installation it might happen, that the system complains:

In that case make sure the library path where the Code::Blocks libraries where installed into is «known» to the system. For example: On Ubuntu using a default build process on a clean system will install the Code::Blocks executables to /use/local/bin and the libraries to /usr/local/lib. The latter is usually not known to a «clean» Ubuntu system. To add it to the search path for libraries do the following (as root / using sudo respectively): Add the following line to the file /etc/ld.so.conf:

That’s it — Code::Blocks should now work just fine as all libraries are being found.

Note that for both you may need super user rights again — so use the sudo command as needed.

Читайте также:  Установка gebo на стояки

источник

Installing Code Blocks

To create and run programs you need two things:

A text editor is where you write your programs. A compiler translates your program into a binary stream of 1s and 0s which computer understands. So whenever you compile a program, the compiler creates a new binary file called executable (having .exe extension in Windows) which computer can execute.

Steps you need to follow while writing C programs.

  1. Create a program
  2. Compile program
  3. Run program

You can create your programs using your default text editor like Notepad in Windows or vim in Linux, but to make things easy we will install a cross-platform >

Why use an IDE?

IDE allows you to create, compile and run programs from a single environment. Code Blocks comes with a compiler called GCC to compile C and C++ programs. If you are not using IDE then you need to create the program using your text editor. Then to compile the program you need to open command prompt or terminal and type some commands. We will first learn how to write a simple program using an IDE, then I will show you how you can create programs using your text editor and compile it using GCC compiler.

Installing Code Blocks in Windows

Step 1: Go to http://www.codeblocks.org/downloads/26 and scroll down a little under Section “Windows XP / Vista / 7 / 8.x / 10:” select “codeblocks-16.01mingw-nosetup.zip”.

It is crucial for you to select MinGW setup because this will install the GCC compiler on your system.

Step 2: After downloading double click on the setup to run it and you will be presented with the following window. Click next to continue.

Step 3: Accept the license agreement and click next.

Step 4: In the next window, Code Blocks will ask you to select components you want to install. Select Full Installation, it will look something like this:

Make sure “MinGW Compiler Suite” is selected because this option will install GCC on your system.

Step 5: Select the destination folder (keep it to default) and click next.

Step 6: The installer will proceed to complete the installation.

Step 7: After completing the installation, Code Blocks will prompt you to run it.


Click no and then click on the Next button.

Click Finish to exit the installer.This completes the installation of Code Blocks on Windows.

Installing Code Blocks in Linux

Code Blocks can run or various Linux distributions. For example Ubuntu, Fedora, CentOS etc. In this section, we will learn how to install Code Blocks on Ubuntu 16.04.1.

Open terminal and type the following command.

After entering this command, you will be asked to press enter. Hit enter and enter the next command:

This command will update all the packages on the system. Finally, enter the following command:

This command will download and install code blocks on your system.

Note: The whole process may take some time if you are on a slow connection. So, please be patient.

The First Run

On Windows go to Start > All Programs > Code Blocks to launch Code Blocks. Alternatively, double-click on the shortcut icon of Code Blocks on the desktop.

On Ubuntu, you can open Code Blocks from the terminal by issuing the following command.

Alternatively, click on the top of the launcher and type some keyword as shown in the screenshot below:

Code Block will now ask you to select default Compiler. Code Block supports several compilers from different vendors. If your computer has some other compiler in addition to GCC, Code Blocks will detect all of them and will show you a list in the window. This computer does not have any compiler except GCC, that’s why only GCC is detected. Select The GCC compiler and click on “Set as default” as shown in the screenshot below:

Click OK to continue. Next, you will be shown a Code Blocks splash screen. After loading completes you will be presented with the following window.

Note: If this is the first time you are running Code Blocks, you may get a window asking you to select Code Blocks as a default application to handle C/C++ source files.

Select “No, leave everything as it is” and click OK.

Menu bar and Toolbar: Like many other GUI programs Code Blocks has the menu bar. The toolbar provides all commonly used commands like Build, Run, Save, Find etc.

Start Page and Editor: Start Page is the default page when Code blocks is launched and editor is where we will write code.

Management Window: This window shows all source files available in your project.

Log Window: This is where you will get all sorts of logs like build messages, compilation errors, warning etc.

источник

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

Adblock
detector