ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
im using the given makefile from can-utils (RASPI bib) and want to include the bcm2835.h to the makefile. Of course i made it with the gcc example example.c -l bcm2835 command but now i need to put it into the makefile. (I also included it into the .c Code)
I'm not really sure what do you mean by that.
Why do you want/need to put it into the makefile?
Hi,
i thought this is the only way to compile the library too.
f.e. make examplefile -lbcm2835 doesn't work.
I made it in a different way, so im done but if this is interesting for another person, how to include this file into the makefile we can maintain this question.
would be nice to explain what did you try (exactly). What do you mean by "to compile the library too".
-lbcm2835 should be put into the makefile, you cannot add it as an argument.
Yeah,
But the only question is where to put this in.
I tried it like this to but seems to be the problem of sorting the arguments, because -lbcm2835 should be after examplefile.c and therefore I dont know where to set this part.
Why not post your Makefile as an example? Including the .h file in the Makefile is not accurate, instead what people need to do is to use the -I argument and add that to the compile flags, typically named CFLAGS or CPPFLAGS and this flag variable is included in the call to the compiler. The -I argument gives the search path for include files. The other important point is that Makefiles care about TAB punctuation over a bunch of SPACES.
There are tons of notations people can, and do, use withing Makefiles, and it is always nice to see what someone has discovered, or what their style is. I keep some old Makefiles I've used around to refer to when I make new projects.
Why not post your Makefile as an example? Including the .h file in the Makefile is not accurate, instead what people need to do is to use the -I argument and add that to the compile flags, typically named CFLAGS or CPPFLAGS and this flag variable is included in the call to the compiler. The -I argument gives the search path for include files. The other important point is that Makefiles care about TAB punctuation over a bunch of SPACES.
There are tons of notations people can, and do, use withing Makefiles, and it is always nice to see what someone has discovered, or what their style is. I keep some old Makefiles I've used around to refer to when I make new projects.
this is just basic stuff i didnīt ask for it. I postet the link above!
including -lbcm2835 into CFLAGES doesnīt solve this.
sure you are right by saying its not about the bcm2853 headerfile into the makefile!
this is just basic stuff i didnīt ask for it. I postet the link above!
including -lbcm2835 into CFLAGES doesnīt solve this.
sure you are right by saying its not about the bcm2853 headerfile into the makefile!
Makefiles "can" be very simple, or they can be somewhat more complex, we haven't seen yours so we do not know what notations you are using.
Yes the concept of specifying a search path for include files is easy, however you do not appear to have clearly understood the former advice about that.
The best way we can help you is for you to post the Makefile you do have, or if you aren't using a Makefile, for you to post the command line call you are making to compile this file.
What I'm seeing (sorry to say) is that you've misinterpreted advice and tried it incorrectly. So please don't be angry with people trying to help you, and instead, give us the information we are asking for so that we can help you.
We are all volunteers on LQ, like yourself. You are welcome on this site and your problem is one which I feel we can help you with.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.