~ubuntu-branches/ubuntu/trusty/anjuta/trusty

« back to all changes in this revision

Viewing changes to manuals/anjuta-manual/sl/project-manager-library-add.page

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2012-02-20 22:38:35 UTC
  • mfrom: (1.1.43)
  • Revision ID: package-import@ubuntu.com-20120220223835-ny223imz62qkk9ns
Tags: 2:3.3.90-0ubuntu1
* New upstream release.
* debian/rules: Watch for unstable releases

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="utf-8"?>
 
2
<page xmlns="http://projectmallard.org/1.0/" type="topic" style="task" id="project-manager-library-add" xml:lang="sl">
 
3
 
 
4
  <info xmlns:facet="http://projectmallard.org/facet/1.0/">
 
5
    <facet:tag key="all-pages" value="whatever"/> <!--Include page in index-->
 
6
    <link type="guide" xref="project-manager-library" group="sixth"/>
 
7
    <link type="seealso" xref="project-manager-target"/>
 
8
    <revision pkgversion="3.0" version="0.1" date="2011-03-27" status="incomplete"/>
 
9
    <desc>
 
10
      Add a custom library to a target.
 
11
    </desc>
 
12
    <credit type="author">
 
13
      <name>Sébastien Granjoux</name>
 
14
      <email>seb.sfo@free.fr</email>
 
15
    </credit>
 
16
    <credit type="editor">
 
17
      <name>Philip Chimento</name>
 
18
      <email>philip.chimento@gmail.com</email>
 
19
    </credit>
 
20
  </info>
 
21
 
 
22
  <title>Add a Custom Library</title>
 
23
 
 
24
  <p>It is easier to use a packaged library, which is common on Linux, so
 
25
  check if it is the case <link xref="project-manager-module-new">here</link>.
 
26
  But else you can still use the library as explained below.</p>
 
27
 
 
28
  <p>In order to use a library in C, you need to tell the compiler
 
29
  where the header files are, and tell the linker where to find the
 
30
  needed libraries. The issue is that your program will not compile
 
31
  on another computer if the header and the libraries are elsewhere.</p>
 
32
 
 
33
  <steps>
 
34
    <item>
 
35
      <p>Select the directory containing the program where you want to
 
36
      add the library in the <gui>project view</gui>, click on the
 
37
      right mouse button to make the <gui>project context menu</gui>
 
38
      appear and select <gui>Properties</gui>.</p>
 
39
 
 
40
      <p>Or from the <gui>main menu</gui>, select <guiseq><gui>Project</gui>
 
41
      <gui>Properties</gui></guiseq>. By default, it edits the
 
42
      properties of the currently selected item in the project view.
 
43
      You can select a different item in the drop-down list button.</p>
 
44
    </item>
 
45
    <item>
 
46
      <p>If the header files are installed in a standard location
 
47
      (<file>/usr/include</file>) you don't have to set this. If not,
 
48
      you need to add <input>-I<var>include_path</var></input> in
 
49
      the <gui>C preprocessor flags</gui> property if you are using
 
50
      <app>gcc</app> as your compiler. You can add several paths separated with
 
51
      spaces. These options will be used for all targets inside this
 
52
      directory.</p>
 
53
 
 
54
      <p>You might have to expand the <gui>More options</gui> button to see this.
 
55
      Click on the <gui>Apply</gui> button when you are done.</p>
 
56
    </item>
 
57
    <item>
 
58
      <p>Next, you need to add the library to a target.
 
59
      Select the target where you want to
 
60
      add the library in the <gui>project view</gui>, click on the
 
61
      right mouse button to make the <gui>project context menu</gui>
 
62
      appear and select <gui>Properties</gui>.</p>
 
63
 
 
64
      <p>Or from the <gui>main menu</gui>, select <guiseq><gui>Project</gui>
 
65
      <gui>Properties</gui></guiseq>. By default, it edits the
 
66
      properties of the currently selected item in the project view.
 
67
      You can select a different item in the drop-down list button.</p>
 
68
    </item>
 
69
    <item>
 
70
      <p>You need to set the <gui>Linker flags</gui> property, adding
 
71
      <input>-l<var>library_name</var></input> if your compiler is <app>gcc</app>.
 
72
      <var>library_name</var> is the name of the library file without the
 
73
      <file>lib</file> prefix and without the <file>.a</file> or
 
74
      <file>.so</file> extension.</p>
 
75
 
 
76
      <p>If the library is in not in a standard directory, <app>gcc</app>
 
77
      can look in additional directories with the option
 
78
      <input>-L<var>library_path</var></input>.</p>  
 
79
    </item>
 
80
  </steps>
 
81
 
 
82
</page>