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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:51:17+00:00 2026-06-02T15:51:17+00:00

I am required to explain what the program located in the following links does:

  • 0

I am required to explain what the program located in the following links does:

main.c

csapp.c

csapp.h

I compile the following code in linux as:

……………………………enter image description here………………………

(note all three files have to be in the same working directory for compilation to work. )

that command is: gcc main.c csapp.c

when I execute that command I get the executable: a.out and I get no compilation errors!

That executable file can be downloaded from here (I don’t think you need that file plus I will not execute that file if I where you).

Anyways I think that if I could debug the program I will be able to understand better what is going on. As a result I have created a C++ console empty console project in visual studio. I will like to include the same files in there and be able to compile it. I have never used c++ before and I don’t really understand where to place header files. This is what I have done hoping to be able to compile the program:

enter image description here

The program will not compile if I place the files like that.

I have also tried placing all the files in the same directory just like on the linux virtual machine:

enter image description here

that does not compile either.

How will I be able to compile that program with visual studio?

  • 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-06-02T15:51:19+00:00Added an answer on June 2, 2026 at 3:51 pm

    If you look at csapp.h you’ll notice it tries to include these headers:

    #include <stdio.h>
    #include <stdlib.h>
    #include <unistd.h>
    #include <string.h>
    #include <ctype.h>
    #include <setjmp.h>
    #include <signal.h>
    #include <sys/time.h>
    #include <sys/types.h>
    #include <sys/wait.h>
    #include <sys/stat.h>
    #include <fcntl.h>
    #include <sys/mman.h>
    #include <errno.h>
    #include <math.h>
    #include <pthread.h>
    #include <semaphore.h>
    #include <sys/socket.h>
    #include <netdb.h>
    #include <netinet/in.h>
    #include <arpa/inet.h>
    

    Some of these are std C headers, but others are specific to POSIX/Linux/UNIX style operating systems (pthread.h for example). You won’t be able to use these libraries on Windows or in Visual Studio unless you’re doing something unusual like compiling against Cygwin libraries.

    If you want to get an understanding of what the program is doing, there’s a number of things you could do. First off, just read through the code and look up the functions it calls in the man pages which document those functions (If you have gcc, I guess you also have man?) second, yes you could print to console to figure stuff out. You could also use a debugger like gdb to step through the program, it’s not as intuitive as VS debugger but it works…

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

Sidebar

Related Questions

Can someone explain me why the following program doesn't work, and how to make
Can someone explain why the following doesn't compile? I want that BB[A] is also
I am using the following code to try to make a RunOnce entry: program
What is the code required to redirect the browser to a new page with
I am required to develop software in English and Spanish and as such all
this is very hard to explain and give code based on it. So thank
In my form panel, i have some fields who are required . I explain
Can you explain to me what the options mean in the following g++ command
Motivation for Question : Generating 64-bit and 32-bit code requires two seperate full-program-compiles, and
Could someone explain what is wrong with this if statement? I get: lvalue required

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.