How can I use the RTL SDR lib for my C application

Show off any of your RTL-SDR or cheap SDR related projects.
Post Reply
A.SDR
Posts: 1
Joined: Thu Oct 18, 2018 2:30 pm

How can I use the RTL SDR lib for my C application

Post by A.SDR » Thu Oct 18, 2018 2:34 pm

0
down vote
favorite

I am trying to create a simple c code to listen to an FM radio channel using an RTL-SDR dongle and as a first step I looked to this rtl-sdr.c file and tried to do the same, for example :

Code: Select all

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "rtl-sdr.h"
#include "convenience.h"


int main(int argc, char *argv[])    
{
    int dev_index = 0;
    dev_index = verbose_device_search("0");
    return 0;
}
I get the following error undefined reference to 'verbose_device_search' and This is my makefile

Code: Select all

CC=gcc
CFLAGS= -O0 -c -Wall
LDFLAGS= 

SOURCES=$ fm.c
OBJECTS=$(SOURCES:.c=.o)

EXECUTABLE=fm

all: $(TASKMAP) $(SOURCES) $(EXECUTABLE)

$(EXECUTABLE): $(OBJECTS) 
    $(CC) $(LDFLAGS) $(OBJECTS) -o [email protected] -lm

.c.o:
    $(CC) $(CFLAGS) $< -lm -o [email protected]

clean: 
    rm -fr $(OBJECTS) $(EXECUTABLE)
can someone put me on track about this problem?

Post Reply