when i try to call a .c file in antother i got a error for multidecalaration of main file.i prepare for a medical shop management using c language what can i do???

You don't directly call a .c file. If you have functions defined in an external file, you create a header file containing the function prototype. This header file is included in any file that uses the function (and in the .c file that defines the function). The compiler and linker take care of the rest.

The only hitch is that you'll get compiler errors if the same header file is included multiple times. You need a preprocessor directive to prevent this. What you choose to call it doesn't matter, but it must be unique. This is how it looks:

/* header_file.h */

#ifndef HEADER_FILE
#define HEADER_FILE

/* function prototypes here */
void function();

#endif

This is what the file containing the function definition might look like:

/* function_file.c */

#include "header_file.h"

void function() {
.
.
.
}

Finally, include the header file as mentioned earlier in every .c file that you need to use the function. Don't forget to add all .c files to your project, or you might end up with linking errors.

when i try to call a .c file in antother i got a error for multidecalaration of main file.i prepare for a medical shop management using c language what can i do???

See if you have two main functions in both the 2 files. If you have 2, delete the one that is not needed.

if suppose its not including then whats the solution

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.