15
15
<name>Philip Chimento</name>
16
16
<email>philip.chimento@gmail.com</email>
19
<mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
20
<mal:name>Jaume Planas</mal:name>
21
<mal:email>jplanas@itberga.com</mal:email>
22
<mal:years>2011</mal:years>
25
<mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
26
<mal:name>Gil Forcada</mal:name>
27
<mal:email>gilforcada@guifi.net</mal:email>
28
<mal:years>2013</mal:years>
20
32
<title>Add a Custom Library</title>
30
<p>Select the directory containing the program where you want to
31
add the library in the <gui>project view</gui>, click on the
32
right mouse button to make the <gui>project context menu</gui>
33
appear and select <gui>Properties</gui>.</p>
35
<p>Or from the <gui>main menu</gui>, select <guiseq><gui>Project</gui>
36
<gui>Properties</gui></guiseq>. By default, it edits the
37
properties of the currently selected item in the project view.
38
You can select a different item in the drop-down list button.</p>
41
<p>If the header files are installed in a standard location
42
(<file>/usr/include</file>) you don't have to set this. If not,
43
you need to add <input>-I<var>include_path</var></input> in
44
the <gui>C preprocessor flags</gui> property if you are using
45
<app>gcc</app> as your compiler. You can add several paths separated with
46
spaces. These options will be used for all targets inside this
49
<p>You might have to expand the <gui>More options</gui> button to see this.
50
Click on the <gui>Apply</gui> button when you are done.</p>
53
<p>Next, you need to add the library to a target.
54
Select the target where you want to
55
add the library in the <gui>project view</gui>, click on the
56
right mouse button to make the <gui>project context menu</gui>
57
appear and select <gui>Properties</gui>.</p>
59
<p>Or from the <gui>main menu</gui>, select <guiseq><gui>Project</gui>
60
<gui>Properties</gui></guiseq>. By default, it edits the
61
properties of the currently selected item in the project view.
62
You can select a different item in the drop-down list button.</p>
65
<p>You need to set the <gui>Linker flags</gui> property, adding
66
<input>-l<var>library_name</var></input> if your compiler is <app>gcc</app>.
67
<var>library_name</var> is the name of the library file without the
68
<file>lib</file> prefix and without the <file>.a</file> or
69
<file>.so</file> extension.</p>
71
<p>If the library is in not in a standard directory, <app>gcc</app>
72
can look in additional directories with the option
73
<input>-L<var>library_path</var></input>.</p>
42
<p>A la <gui>vista de projecte</gui>, trieu el directori (que conté el programa) on voleu afegir la biblioteca, feu clic al botó secundari perquè es mostri el <gui>menú contextual del projecte</gui> i trieu <gui>Propietats</gui>.</p>
44
<p>O trieu <guiseq><gui>Projecte</gui><gui>Propietats</gui></guiseq> en el <gui>menú principal</gui>. Per defecte s'editen les propietats de l'element seleccionat actualment a la vista de projecte. Podeu seleccionar un altre element al botó de llista desplegable.</p>
47
<p>Si els fitxers de capçalera són instal·lats a una ubicació estàndard (<file>/usr/include</file>) no cal que ho definiu. En cas contrari i si utilitzeu el <app>gcc</app> com a compilador, heu d'afegir <input>-I<var>camí_inclusió</var></input> a la propietat <gui>Indicadors del preprocessador de C</gui>. Podeu afegir diversos camins separats per espais. S'utilitzaran aquestes opcions en tots els objectius dins d'aquest directori.</p>
49
<p>Potser haureu de desplegar el botó <gui>Més opcions</gui> per veure-ho. Feu clic al botó <gui>Aplica</gui> quan acabeu.</p>
52
<p>Tot seguit, heu d'afegir la biblioteca a un objectiu. A la <gui>vista de projecte</gui>, trieu l'objectiu on voleu afegir la biblioteca, feu clic al botó secundari del ratolí perquè es mostri el <gui>menú contextual del projecte</gui> i trieu <gui>Propietats</gui>.</p>
54
<p>O trieu <guiseq><gui>Projecte</gui><gui>Propietats</gui></guiseq> en el <gui>menú principal</gui>. Per defecte s'editen les propietats de l'element seleccionat actualment a la vista de projecte. Podeu seleccionar un altre element al botó de llista desplegable.</p>
57
<p>Heu de definir la propietat <gui>Indicadors de l'enllaçador</gui>; si el compilador és el <app>gcc</app>, afegiu <input>-l<var>nom_biblioteca</var></input>. <var>nom_biblioteca</var> és el nom del fitxer de biblioteca sense el prefix <file>lib</file> i sense l'extensió <file>.a</file> o <file>.so</file>.</p>
59
<p>Si la biblioteca no és a un directori estàndard, el <app>gcc</app> pot cercar a més directoris si especifiqueu l'opció <input>-L<var>camí_biblioteca</var></input>.</p>