Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7624919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:05:49+00:00 2026-05-31T05:05:49+00:00

I got a problem with including files. What I’ve basically made is a command-line

  • 0

I got a problem with including files.
What I’ve basically made is a command-line program in C that works with a csv file. It has 5 commands: -menu, -add, -edit, -del, -verify. All is good except for the -menu. What needs to happen when I type “./passweb -menu” is for a visual menu to appear. This menu command should call a new function and it needs to be located in a separate c file (aka menu.c).

The problem I’m having right now is that I’m not too sure how to include the files to run in the menu.c because the way I have it set up right now, passweb.c has all the functions such as -add and -edit and etc. I know you need to make header files and such but it’s complaining that I’ve declared the methods twice which is true since I use the functions in the menu file.

Here’s some of the code:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cipher.h"
#include "menu.h"
#include "passweb.h"
#define MAXLENGTH 51 //longest length of a single record + 1 =51 bytes
#define SIZEOFDB 1000
#define ENCRYPT 5

typedef struct rec
{
    char name[MAXLENGTH];
    char pw[MAXLENGTH];
    char type[6];
    int boolean;
}RECORD;

int add(char *nName, char *nPw, char *nType, RECORD *arr, int size);
void del (char *tName, RECORD *arr, int size);
int edit(char *nName, char *nPw, char *nType, char *tName, char *tPw, RECORD *arr, int size);
int verify (char *tName, char *tPw, RECORD *arr,int size);

This is my main file “passweb.c” and it’s declared the functions.
Later on in the main, I will call a menu function which is located in a menu.c file.
In the menu function I use “add”,”edit”,”del” and etc that I wrote in this .c file.
As you can see on the top, I have included the header files.

What can I do to solve this problem?
Sorry for the long post.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T05:05:51+00:00Added an answer on May 31, 2026 at 5:05 am

    You should put function prototype in the header file. You should put its implementation in the source file, which should include the header file.

    For example, the header (test.h) would have the structure definitions and function prototypes like:

    #ifndef TEST_H
    #define TEST_H
    struct myStruct {
      int x;
    };
    
    int Add(int lhs, int rhs);
    #endif
    

    And the source would have:

    #include "test.h"
    #include <stdio.h>
    int Add(int lhs, int rhs)
    {
      return lhs+rhs;
    }
    int main()
    {
      printf("%d",Add(2,3));
      return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got problem while including header files, in every header file i use #pragma
I got a problem about including a included file in PHP. Project functions(folder) has
I just got a strange problem. I am including some files from my index.php,
I'm havin a problem in including my files. I got 3 C++ files and
I've got some files using raw php (including config files) that's used for the
Here's the problem I'm having, I've got a set of logs that can grow
I've got a VB.NET module that reads from a resource file to display text
I got a problem where I want to use template including in Django. Here
I got a problem with this: I got file xxx.php in which I'm parsing
I've got a collection of short WAV files that I would like to process

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.