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:
-- 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.