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 6676313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:58:20+00:00 2026-05-26T03:58:20+00:00

I’m working on my exam assignment. It’s due in almost 6 hours. Suddenly my

  • 0

I’m working on my exam assignment. It’s due in almost 6 hours. Suddenly my program won’t compile anymore with this error message:

gcc -g -D DEBUG -c -o obj/stringops.o src/stringops.c
gcc -g -D DEBUG -c -o obj/arrayops.o src/arrayops.c
gcc -g -D DEBUG -c -o obj/fileops.o src/fileops.c
gcc -g -D DEBUG -c -o obj/builtins.o src/builtins/*.c
gcc -g -D DEBUG -c -o obj/tomashell.o src/tomashell.c
gcc -g -D DEBUG -o bin/tomashell \
                obj/stringops.o obj/arrayops.o obj/fileops.o obj/builtins.o \
                obj/tomashell.o
obj/tomashell.o: In function `n_processes':
/root/sc/tomashell/src/safefork.c:11: multiple definition of `h_meta'
obj/builtins.o:/root/sc/tomashell/src/builtins/history.c:4: first defined here
obj/tomashell.o: In function `n_processes':
/root/sc/tomashell/src/safefork.c:11: multiple definition of `h_meta_len'
obj/builtins.o:/root/sc/tomashell/src/builtins/history.c:4: first defined here
collect2: ld returned 1 exit status
make: *** [bin/tomashell] Error 1

In this file:

#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/errno.h>

extern int errno;

#define MAX_PROCESSES 6

static int n_processes(void)
{ // <- THIS IS LINE 11
    return system("exit `ps | wc -l`")/256;
}


pid_t safefork(void)
{
  static int n_initial = -1;

  if (n_initial == -1)
    n_initial = n_processes();
  else if (n_processes() >= n_initial+MAX_PROCESSES) {
    sleep(2);
    errno = EAGAIN;  return (pid_t)-1;
  }

  return fork();
}

Someone please help me or kill me. I don’t want to live in a world where this sort of error is possible.

Any ideas to what might be wrong?

builtins/history.c
builtins/history.h

  • 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-26T03:58:20+00:00Added an answer on May 26, 2026 at 3:58 am

    Like the others have said, you should not “define” (either implicitly or explicitly allocate space for) a variable in your headers.

    This example might help:

    #ifndef HISTORY
    #define HISTORY
    ...
    
    /* Bad!  Don't actually DEFINE (allocate space for) variables in a header!
     * h_metablock* h_meta = NULL;
     * int h_meta_len = 0;
     */
    
    /* Better: declare "extern", then define in exactly ONE module (e.g. "main.c") */
    extern h_metablock* h_meta;
    extern int h_meta_len;
    ...
    

    The same, of course, goes for any globals you might define in your .c/.cpp files.

    A global can only be “defined” exactly once.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Does anyone know how can I replace this 2 symbol below from the string
I'm working with an upstream system that sometimes sends me text destined for HTML/XML

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.