libcflie icon indicating copy to clipboard operation
libcflie copied to clipboard

Compiling against using makefile

Open rshum19 opened this issue 9 years ago • 4 comments

Hi,

I'm trying to link against the library but I'm having some trouble during compilation with a makefile. I believe the issue is that its not link the libusb-1.0 library since I get the following error:

//usr/local/lib/libcflie.a(CCrazyRadio.cpp.o): In function CCrazyRadio::CCrazyRadio(std::string)': CCrazyRadio.cpp:(.text+0x87): undefined reference tolibusb_init'

My makefile is as followed:

CC = g++ CFLAGS = -Wall -g

all: simple

simple: simple.o ${CC} ${CFLAGS} simple.o -lusb-1.0 -lcflie -o simple

simple.o: simple.cpp CCrazyflie.h ${CC} ${CFLAGS} -c simple.cpp

clean: rm simple.o simple

To point something out I have moved libcflie.a file to /usr/local/lib. Can someone give a had solving this issue??

rshum19 avatar Aug 09 '15 03:08 rshum19

When you try to compile the CMake project that comes with the library, what happens? It is linking against libusb-1.0 here. If this works, something might be off with your Makefile.

Things you could try:

  • Compile the CMake project, look for this message: The USB libs appear to not be installed.
  • Change the linking order in your Makefile from -lusb-1.0 -lcflie to -lcflie -lusb-1.0
  • Change the compiler from g++ to gcc (this is a rather desperate measure)

Cheers

fairlight1337 avatar Aug 10 '15 07:08 fairlight1337

The issue was on my Makefile. Changing the linking order solved the issue.

Thanks for the help. Just to let you know I'm using your library to make a Matlab Simulink library.

rshum19 avatar Aug 10 '15 18:08 rshum19

Great to hear, both of it! When you got the library running, I'd love to have a look!

fairlight1337 avatar Aug 10 '15 20:08 fairlight1337

This is spam and steal my personal information.. don't trust this. Because someone who stolen my clip from my compute I have to stop this from use my ID for fraud. Pls be careful with fake profit honest I never sign up GitHub member so far til I found out something appear on my VPN show me lists of hackers that's why I am here to tell this one which belong to me I will ask for cancel this when you get it from this. I suggest you all pls don't steal people a cell and Amy devices FBI will look thought google map and more app. I am waive because they found out already. They send me lists of hack who accessing my device. I block all of them. It real pain my ass. Evil people who is cleverly to use people a account transfer.. they will find you asap

Silenceman65 avatar Jan 04 '22 11:01 Silenceman65