You are not logged in.

#1 2012-10-09 08:29:51

bahramwhh
Member
Registered: 2011-02-12
Posts: 17

[SOLVED] crt1.o error when trying to compile

Hi everybody,
I'm trying to compile a simple rtnetlink example written in c using gcc [ver 4.7.2] but I get this error :

/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../lib/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status

and here is the include parts of example :

#include <sys/socket.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <arpa/inet.h>
#include <unistd.h>

Should I add a specific library or something ?! (I tried netlink and pthreads libraries and it didn't work)

thanks in advance

Last edited by bahramwhh (2012-10-09 09:34:56)

Offline

#2 2012-10-09 09:06:41

lunar
Member
Registered: 2010-10-04
Posts: 95

Re: [SOLVED] crt1.o error when trying to compile

@bahramwhh We'll need to complete source code and the exact compiler and link invocation to help you.

Offline

#3 2012-10-09 09:34:40

bahramwhh
Member
Registered: 2011-02-12
Posts: 17

Re: [SOLVED] crt1.o error when trying to compile

@lunar oh, I'm sorry, my problem solved. my file didn't have the main function !

Last edited by bahramwhh (2012-10-09 09:35:29)

Offline

Board footer

Powered by FluxBB