B
bowlderyu
Hello, all.
I meet a question about compiling files.
Eg., I have three files named myfile.h, myfile.c and the main.c file,
and there is a function, ex, void myfun(...).
If I put myfun(...) in the main.c file like the following,
.....
void myfun(...)
{
.....
}
int main(void)
{
....
}
it works well.
But when I move myfun(...) to the file of myfile.c, and a make error
message appears when the same command "make" runs, although I have
declear the myfun(...) function in the main function.
The message seems that the myfun(...) is not decleared before used.
And this is my Makefile:
#test Makefile
objects=main.o
test:$(objects)
cc -o test $(objects) -lgsl -lgslcblas -lm
..PHONY:clean
clean:
rm test $(objects)
My code may be not very clear, so I don't attach it here.
I just move a function from one file to another, and give some
declearation in the header and main files. But it cann't work.
It will be appreciate for you help.
Thanks.
I meet a question about compiling files.
Eg., I have three files named myfile.h, myfile.c and the main.c file,
and there is a function, ex, void myfun(...).
If I put myfun(...) in the main.c file like the following,
.....
void myfun(...)
{
.....
}
int main(void)
{
....
}
it works well.
But when I move myfun(...) to the file of myfile.c, and a make error
message appears when the same command "make" runs, although I have
declear the myfun(...) function in the main function.
The message seems that the myfun(...) is not decleared before used.
And this is my Makefile:
#test Makefile
objects=main.o
test:$(objects)
cc -o test $(objects) -lgsl -lgslcblas -lm
..PHONY:clean
clean:
rm test $(objects)
My code may be not very clear, so I don't attach it here.
I just move a function from one file to another, and give some
declearation in the header and main files. But it cann't work.
It will be appreciate for you help.
Thanks.