Hi,
I use C-Free 4.0 editor for executing C programs.

I have a Treap program that I obtained online which is organized as

testtrp.c
treap.c
treap.h
fatal.h

When I compile the testtrp.c, which references treap.c it compiles correctly. However when I try to run it I get the undefined reference errors to all methods that are found in treap.c

How should I include treap.c to be used while executing testtrp.c?

testtrp.c explicitly includes treap.h, however there is no explicit reference to treap.c. I obtained this code from a textbook's website so the code is correct.
It is just that I am a newbie to C and I dont know how to execute such programs. I have googled extensively on this and most of the help I got said that there could be spelling errors and I checked them to ensure there are no such errors.


Thanks for your time,
Asana

You need to compile both files, as in cc -o prog testtrp.c treap.c Of course, exact details for your IDE will vary, but that's the essence of what you need to do.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.