Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot link with LORCON with application #6

Open
xieyaxiongfly opened this issue Oct 16, 2017 · 0 comments
Open

Cannot link with LORCON with application #6

xieyaxiongfly opened this issue Oct 16, 2017 · 0 comments

Comments

@xieyaxiongfly
Copy link

Hi there,

I have problem linking lorcon library with my code.

I have installed LORCON on openWRT using the source code from this Github. It works fine.

When I want to write a piece of code to making use lorcon, it has a problem linking lorcon.

My test code is quite simple,
First of all, I include the headers using

#include <lorcon.h>
#include <lorcon_packet.h>

Second, I called the "lorcon_list_drivers" and "lorcon_free_driver_list".

My Makefile is as follows:

CC = mips-openwrt-linux-musl-gcc

LDFLAGS = -L/home/alex/openwrt/trunk/openwrt/staging_dir/target-mips_34kc_musl-1.1.16/usr/lib/lorcon

CFLAGS = -I/home/alex/openwrt/trunk/openwrt/staging_dir/target-mips_34kc_musl-1.1.16/usr/include/lorcon2 -O3 -Wall -static -DHAVE_CONFIG_H

OBJS = injector_v1.o

injector_v1: injector_v1.c 
	$(CC) $(CFLAGS)  injector_v1.c -o injector_v1  $(LDFLAGS)  

all: injector_v1

When I compile, I got an error:

/tmp/cci1WCop.o: In function `usage':
injector_v1.c:(.text+0x20): undefined reference to `lorcon_list_drivers'
injector_v1.c:(.text+0x7c): undefined reference to `lorcon_free_driver_list'

What's the problem here?

I also tried
$(CC) $(CFLAGS) injector_v1.c -o injector_v1 $(LDFLAGS) -lorcon2
and it says:
openwrt/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.16/lib/gcc/mips-openwrt-linux-musl/5.3.0/../../../../mips-openwrt-linux-musl/bin/ld: cannot find -lorcon2

Any help will be appreciated.

Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant