ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
#include "bsort.c"
void op
{
printf("The final sorted array is...");
for (j=0 ; j<=10 ; ++j)
printf("%d", c[j]);
}
I am having a lot of errors that I am not able to correct...!!!!!!!
Errors are mainly due to multiple declarations of the functions....I cannot debug those errors.....
Please help !!!!!
:|
I cannot debug those errors.....
Please help !!!!!
:|
Hi there!
Thank you for providing all the program code. The more information included, the better.
But:
While we probably have members who can determine exactly what errors you are getting just by looking at the code, it is generally a very good idea to include the errors in your thread!
So, please show us the error-filled output that you get when you execute `make` on your Makefile, so folks can see exactly what errors you're getting..
@GrapefruiTgirl....
This is the long list of errors......!!!!! :\
Code:
mint@mint ~/Templates $ make
gcc -c main.c
make: Warning: File `A.h' has modification time 3e+05 s in the future
gcc -c input.c
gcc -o animesh main.o input.o bsort.o output.o
input.o: In function `insert':
input.c:(.text+0x0): multiple definition of `insert'
main.o:main.c:(.text+0x0): first defined here
bsort.o: In function `insert':
bsort.c:(.text+0x0): multiple definition of `insert'
main.o:main.c:(.text+0x0): first defined here
bsort.o: In function `bub_sort':
bsort.c:(.text+0x57): multiple definition of `bub_sort'
main.o:main.c:(.text+0x57): first defined here
output.o: In function `insert':
output.c:(.text+0x0): multiple definition of `insert'
main.o:main.c:(.text+0x0): first defined here
output.o: In function `bub_sort':
output.c:(.text+0x57): multiple definition of `bub_sort'
main.o:main.c:(.text+0x57): first defined here
output.o: In function `op':
output.c:(.text+0x118): multiple definition of `op'
main.o:main.c:(.text+0x118): first defined here
collect2: ld returned 1 exit status
make: *** [animesh] Error 1
If anybody can please make out how to correct them....Thanks....
When you #include a file, it is the same as copy pasting the entire contents in place of the #include line. So when you put #include input.c inside of bsort.c it will have all the text of bsort.c so it will define bub_sort() too. That means that both bsort.o and input.o will have definitions for bub_sort(). You can't link 2 .o files defining the same function together, thus all your errors.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.