# Errors in ./your\_program.sh when running first task in Build your own HTTP

**URL:** <https://forum.codecrafters.io/t/errors-in-your-program-sh-when-running-first-task-in-build-your-own-http/8303>\
**Category:** Challenges\
**Tags:** challenge:http-server\
**Created:** [April 6, 2025, 7:01am UTC](https://forum.codecrafters.io/t/errors-in-your-program-sh-when-running-first-task-in-build-your-own-http/8303 "2025-04-06T07:01:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sarthaktanwani](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/sarthaktanwani/32/8688_2.png) [@sarthaktanwani](https://forum.codecrafters.io/u/sarthaktanwani)\
**Post date:** [April 6, 2025, 7:01am UTC](https://forum.codecrafters.io/t/errors-in-your-program-sh-when-running-first-task-in-build-your-own-http/8303/1 "2025-04-06T07:01:36Z")

</div>

Hi,  
I started the “Build your own HTTP” project in C and I am getting the following error when trying to run my HTTP server locally:

```auto
-- Running vcpkg install
All requested packages are currently installed.
Total install time: 49.9 us
-- Running vcpkg install - done
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (1.0s)
-- Generating done (0.0s)
-- Build files have been written to: /home/sarthak/Documents/self-learn/codecrafters/codecrafters-http-server-c/build
[33%] Building C object CMakeFiles/http-server.dir/src/CMakeFiles/3.16.3/CompilerIdC/CMakeCCompilerId.c.o
[66%] Building C object CMakeFiles/http-server.dir/src/main.c.o
[100%] Linking C executable http-server
/usr/bin/ld: CMakeFiles/http-server.dir/src/main.c.o: in function `main':
main.c:(.text+0x0): multiple definition of `main'; CMakeFiles/http-server.dir/src/CMakeFiles/3.16.3/CompilerIdC/CMakeCCompilerId.c.o:CMakeCCompilerId.c:(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/http-server.dir/build.make:116: http-server] Error 1
make[1]: *** [CMakeFiles/Makefile2:87: CMakeFiles/http-server.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

```

I have installed cmake version 4.0. Pls help me debug this linker error saying that I have 2 instances of the function main.  
I have not currently made any changes to my repository, I have only uncommented the code as the first task “Bind to a port” and I wanted to run it locally.

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [April 6, 2025, 1:31pm UTC](https://forum.codecrafters.io/t/errors-in-your-program-sh-when-running-first-task-in-build-your-own-http/8303/3 "2025-04-06T13:31:44Z")

</div>

Hey @sarthaktanwani, could you [upload your code to GitHub](https://docs.codecrafters.io/features/publish-to-github) and share the link? It will be much easier to debug if I can run it directly.

---

<div class="post-metadata">

**Author:** ![sarthaktanwani](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/sarthaktanwani/32/8688_2.png) [@sarthaktanwani](https://forum.codecrafters.io/u/sarthaktanwani)\
**Post date:** [April 7, 2025, 1:06am UTC](https://forum.codecrafters.io/t/errors-in-your-program-sh-when-running-first-task-in-build-your-own-http/8303/4 "2025-04-07T01:06:51Z")

</div>

Hey @andy1li thanks for the response  
It is working for me now. I had an earlier version of cmake (v3.18) running on my Zorin (Ubuntu based) system. Unfortunately, cmake is not updated in Ubuntu apt repositories.

I had to update the repository, reinstall cmake (v4.0).  
Ref: [software installation - How do I install the latest version of cmake from the command line? - Ask Ubuntu](https://askubuntu.com/questions/355565/how-do-i-install-the-latest-version-of-cmake-from-the-command-line)

I was getting the error because some of the build files were generated using an earlier version of cmake so I had to remove the entire codecrafters repo, clone it again and then run the example.

Hope this helps someone in the future!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/7/0/700657133935c15703e22c7c8870394f6e6dc27d.svg) [@system](https://forum.codecrafters.io/u/system)\
**Post date:** [April 13, 2025, 11:04pm UTC](https://forum.codecrafters.io/t/errors-in-your-program-sh-when-running-first-task-in-build-your-own-http/8303/5 "2025-04-13T23:04:28Z")

</div>

Closed on April 13, 2025, 11:04pm UTC

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.
