Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Undefined references with multiple headers

Thread Tools

Undefined references with multiple headers

smc smc is offline
Junior Member
Join Date: Dec 2010
Posts: 2
Hi guys,

I have some problem to create a executable.

I have a program test.c (which contains the main() ). This includes one 1.h where is defined the prototype of some functions (which are given by 1.c), but also this 1.h includes other 2.h where C structures are given. This code is needed for 1.c (and other modules).

So, the gcc generates the object code without problems for 1.c ($gcc -I ../include -o 1.o -c 1.c). But when I try to generate the executable of test , I get undefined references problems. I try to create the executable as follows:

$ gcc -I ../include -o test test.o 1.o -lm

(In ../include are all .h)

This fail with undefined reference to the C structures given by 2.h.

Any idea?
Reply With Quote
smc smc is offline
Junior Member
Join Date: Dec 2010
Posts: 2
Nobody can help me?
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with wsgiref.headers.Headers Phil Python 4 01-17-2010 04:47 PM
Help needed interpreting 'References' in message Headers ~BD~ Computer Security 4 05-21-2009 04:57 AM
Server cannot clear headers after HTTP headers have been sent Ian ASP .Net Security 2 03-20-2007 09:00 AM
does it matter whether References headers are folded? Nomen Nescio Perl Misc 11 09-25-2006 11:58 PM
Reading 'received' headers: Email Headers Parsing dont bother Python 0 03-03-2004 08:18 PM