# C++ #ND2 challenge build time is taking so much that it causes the time to exceed

**URL:** <https://forum.codecrafters.io/t/c-nd2-challenge-build-time-is-taking-so-much-that-it-causes-the-time-to-exceed/14041>\
**Category:** Challenges\
**Tags:** challenge:bittorrent\
**Created:** [July 27, 2025, 6:56am UTC](https://forum.codecrafters.io/t/c-nd2-challenge-build-time-is-taking-so-much-that-it-causes-the-time-to-exceed/14041 "2025-07-27T06:56:16Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ycsvenom](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/ycsvenom/32/2609_2.png) [@ycsvenom](https://forum.codecrafters.io/u/ycsvenom)\
**Post date:** [July 27, 2025, 6:56am UTC](https://forum.codecrafters.io/t/c-nd2-challenge-build-time-is-taking-so-much-that-it-causes-the-time-to-exceed/14041/1 "2025-07-27T06:56:16Z")

</div>

I’m stuck on Stage #ND2.

My sole problem is that when I try to test my code it always exceeds the time. because all the time taken by building step, which weirdly is included in the test time

Here are my logs:

```auto
[compile] Compilation successful.
[tester::#ND2] Running tests for Stage #ND2 (Download a piece)
[tester::#ND2] Running ./your_bittorrent.sh download_piece -o /tmp/torrents3170529684/piece-9 /tmp/torrents3170529684/itsworking.gif.torrent 9
[your_program] -- Running vcpkg install
[your_program] All requested packages are currently installed.
[your_program] All requested installations completed successfully in: 40.8 us
[your_program] -- Running vcpkg install - done
[your_program] -- The C compiler identification is GNU 14.2.0
[your_program] -- The CXX compiler identification is GNU 14.2.0
[your_program] -- Detecting C compiler ABI info
[your_program] -- Detecting C compiler ABI info - done
[your_program] -- Check for working C compiler: /usr/bin/cc - skipped
[your_program] -- Detecting C compile features
[your_program] -- Detecting C compile features - done
[your_program] -- Detecting CXX compiler ABI info
[your_program] -- Detecting CXX compiler ABI info - done
[your_program] -- Check for working CXX compiler: /usr/local/bin/c++ - skipped
[your_program] -- Detecting CXX compile features
[your_program] -- Detecting CXX compile features - done
[your_program] -- Configuring done (6.0s)
[your_program] -- Generating done (0.0s)
[your_program] -- Build files have been written to: /app/build
[your_program] [5%] Building CXX object CMakeFiles/bittorrent.dir/src/commands/decode.cpp.o
[your_program] [10%] Building CXX object CMakeFiles/bittorrent.dir/src/commands/download_piece.cpp.o
[tester::#ND2] timed out, test exceeded 10 seconds
[tester::#ND2] Test failed (try setting 'debug: true' in your codecrafters.yml to see more details)

```

---

<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:** [July 27, 2025, 11:44am UTC](https://forum.codecrafters.io/t/c-nd2-challenge-build-time-is-taking-so-much-that-it-causes-the-time-to-exceed/14041/4 "2025-07-27T11:44:23Z")

</div>

Hey @ycsvenom, I’ve pushed a fix to your repo. You can run `git pull` to sync the changes.

Let me know if you’re still running into issues!

---

<div class="post-metadata">

**Author:** ![ycsvenom](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/ycsvenom/32/2609_2.png) [@ycsvenom](https://forum.codecrafters.io/u/ycsvenom)\
**Post date:** [July 27, 2025, 1:06pm UTC](https://forum.codecrafters.io/t/c-nd2-challenge-build-time-is-taking-so-much-that-it-causes-the-time-to-exceed/14041/6 "2025-07-27T13:06:32Z")

</div>

Okay, thanks for updating the template, but there is still a problem  
It would fail with this error when the test is being executed

```auto
Initiating test run...

⚡ This is a turbo test run. https://codecrafters.io/turbo

Running tests. Logs should appear shortly...

[compile] -- Running vcpkg install
[compile] All requested packages are currently installed.
[compile] All requested installations completed successfully in: 56.7 us
[compile] -- Running vcpkg install - done
[compile] -- The C compiler identification is GNU 14.2.0
[compile] -- The CXX compiler identification is GNU 14.2.0
[compile] -- Detecting C compiler ABI info
[compile] -- Detecting C compiler ABI info - done
[compile] -- Check for working C compiler: /usr/bin/cc - skipped
[compile] -- Detecting C compile features
[compile] -- Detecting C compile features - done
[compile] -- Detecting CXX compiler ABI info
[compile] -- Detecting CXX compiler ABI info - done
[compile] -- Check for working CXX compiler: /usr/local/bin/c++ - skipped
[compile] -- Detecting CXX compile features
[compile] -- Detecting CXX compile features - done
[compile] -- Configuring done (4.9s)
[compile] CMake Error at /vcpkg/scripts/buildsystems/vcpkg.cmake:599 (_add_executable):
[compile] No SOURCES given to target: tests
[compile] Call Stack (most recent call first):
[compile] CMakeLists.txt:25 (add_executable)
[compile] 
[compile] 
[compile] CMake Generate step failed. Build files cannot be regenerated correctly.
[compile] Looks like your code failed to compile.
[compile] If you think this is a CodeCrafters error, please let us know at hello@codecrafters.io.

```

even though that there is `TEST_SOURCES` given for `tests` target it will still fail. if I commented everything for `tests` it will return to normal but I don’t want to do that since it will diverge into inconvenience later

---

<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:** [July 27, 2025, 4:24pm UTC](https://forum.codecrafters.io/t/c-nd2-challenge-build-time-is-taking-so-much-that-it-causes-the-time-to-exceed/14041/7 "2025-07-27T16:24:30Z")

</div>

@ycsvenom Looks like `codecrafters test` was having trouble picking up the changes from `CMakeLists.txt` and `src/tests`.

Could you try committing and pushing those changes to see if that resolves the `No SOURCES given to target: tests` issue?

I can get a new error after doing that:

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/6/6dd91fa8a5094c0b3b2ffc45a6442e887892451a.jpeg)

---

<div class="post-metadata">

**Author:** ![ycsvenom](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/ycsvenom/32/2609_2.png) [@ycsvenom](https://forum.codecrafters.io/u/ycsvenom)\
**Post date:** [July 29, 2025, 5:20am UTC](https://forum.codecrafters.io/t/c-nd2-challenge-build-time-is-taking-so-much-that-it-causes-the-time-to-exceed/14041/8 "2025-07-29T05:20:33Z")

</div>

Sorry for late response,  
Can’t you make a new branch? it’s best to not mess a lot with the branch just for debugging  
Thanks a lot

---

<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:** [July 29, 2025, 12:53pm UTC](https://forum.codecrafters.io/t/c-nd2-challenge-build-time-is-taking-so-much-that-it-causes-the-time-to-exceed/14041/9 "2025-07-29T12:53:34Z")

</div>

@ycsvenom I haven’t made any changes to your master branch since the initial fix. The screenshot above was from a cloned copy.

Could you try committing and pushing any changes (instead of using `codecrafters test`) to see if that resolves the `No SOURCES given to target: tests` issue?

---

<div class="post-metadata">

**Author:** ![ycsvenom](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/ycsvenom/32/2609_2.png) [@ycsvenom](https://forum.codecrafters.io/u/ycsvenom)\
**Post date:** [August 1, 2025, 6:58pm UTC](https://forum.codecrafters.io/t/c-nd2-challenge-build-time-is-taking-so-much-that-it-causes-the-time-to-exceed/14041/10 "2025-08-01T18:58:49Z")

</div>

I am sorry again for keeping you wait, I had a severe muscle strain in my neck and my free period has ended so there is no point to fix it, thanks again anyway, In the mean time I will try to fix my code to handle multiple peers instead of because it keeps getting time exceeded for one piece downloads

---

<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:** [August 1, 2025, 7:04pm UTC](https://forum.codecrafters.io/t/c-nd2-challenge-build-time-is-taking-so-much-that-it-causes-the-time-to-exceed/14041/11 "2025-08-01T19:04:59Z")

</div>

No worries at all. Hope you’re feeling better now!

---

<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:** [August 6, 2025, 7:05pm UTC](https://forum.codecrafters.io/t/c-nd2-challenge-build-time-is-taking-so-much-that-it-causes-the-time-to-exceed/14041/12 "2025-08-06T19:05:26Z")

</div>

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