Hi
I tried to make a library using code blocks. For which I went file->new->project->static library and name it as mylib and then i created a file mylib1.c and mylib1.h (with some sample functions in it like Swap) and build them. Now I again make another project hello in which i make a file main.c in which I included lib1.h. When i tried to run the program i got the message "please select the host to run the library" something like that. Then i google it and then i went to project->build options->linker setting and then i add ..\mylib\libmyl ib.a. After that i got the error
lib1.h-No such file or directory.
What should i do?
Here is the code
For library
lib1.c
lib1.h
Then another project Hello i made main.c
What should i do?I am using codeblocks with mingw under windows?
I have attached the screenshot also
I tried to make a library using code blocks. For which I went file->new->project->static library and name it as mylib and then i created a file mylib1.c and mylib1.h (with some sample functions in it like Swap) and build them. Now I again make another project hello in which i make a file main.c in which I included lib1.h. When i tried to run the program i got the message "please select the host to run the library" something like that. Then i google it and then i went to project->build options->linker setting and then i add ..\mylib\libmyl ib.a. After that i got the error
lib1.h-No such file or directory.
What should i do?
Here is the code
For library
lib1.c
Code:
// The functions contained in this file are pretty dummy
// and are included only as a placeholder. Nevertheless,
// they *will* get included in the static library if you
// don't remove them :)
//
// Obviously, you 'll have to write yourself the super-duper
// functions to include in the resulting library...
// Also, it's not necessary to write every function in this file.
// Feel free to add more files in this project. They will be
// included in the resulting library.
// A function adding two integers and returning the result
int SampleAddInt(int i1, int i2)
{
return i1 + i2;
}
// A function doing nothing ;)
void Swap(int *a , int *b)
{
*a=*a+*b;
*b=*a-*b;
*a=*a-*b;
}
// A function always returning zero
int Increa(int x)
{
return ++x;
return 0;
}
Code:
void Swap(int *a , int *b); int Increa(int x); int SampleAddInt(int i1, int i2);
Code:
#include <stdio.h>
#include <stdlib.h>
#include"lib1.h"
int main()
{
int a=1,b=2;
Swap(&a,&b);
printf("%d %d",a,b);
return 0;
}
What should i do?I am using codeblocks with mingw under windows?
I have attached the screenshot also
Comment