User forums > Help
How can I link a lib from “The Art and Science of C”
(1/1)
Fibonacci:
I am using “The Art and Science of C” to learn C.If you want to write a program,you need to use his lib.I download it but i don't konw how to link it..
Here is my settings:
1.create a new project and select all .h & .c files from "standard" folder
2.build it ---- successful
3.open an example c source file(add2.c)
--- Code: ---#include <stdio.h>
#include "genlib.h"
#include "simpio.h"
main()
{
int n1, n2, total;
printf("This program adds two numbers.\n");
printf("1st number? ");
n1 = GetInteger();
printf("2nd number? ");
n2 = GetInteger();
total = n1 + n2;
printf("The total is %d.\n", total);
}
--- End code ---
4.bulid it,then it has an messages.
--- Code: ---\programs\03-Problem-Solving\add10.c|11|error: genlib.h: No such file or directory|
\programs\03-Problem-Solving\add10.c|12|error: simpio.h: No such file or directory|
||=== Build finished: 2 errors, 0 warnings ===|
--- End code ---
5.What can i do if i want to link this lib?I search the internet and view all the topics that related to this topic,but i still don't know how to link it..orz.
PS:Settings--Global xxx---Linker Settings--add the .a files . it can't work.
6.
Code::Blocks version:10.05
Complier:GCC
OS:Windows XP SP3
You can download this source from http://www.rayfile.com/files/fb21770c-f64b-11df-90bb-0015c55db73d/
stahta01:
This IS NOT a site that teaches basic programming.
Learn the difference between Compiler and Linker Errors!
An .h file is NOT a library; it is an header!
You are having an Compiler Error when you get a message about not finding an .h file.
Add, the path to the not found header(s) to the Compiler Search Path under the Project "Build Options"
Tim S.
Navigation
[0] Message Index
Go to full version