# Getting a Build failed Error in Clion

**URL:** <https://forum.codewithmosh.com/t/getting-a-build-failed-error-in-clion/29455>\
**Category:** C++\
**Created:** [October 26, 2024, 7:05am UTC](https://forum.codewithmosh.com/t/getting-a-build-failed-error-in-clion/29455 "2024-10-26T07:05:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Subho2024](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@Subho2024](https://forum.codewithmosh.com/u/Subho2024)\
**Post date:** [October 26, 2024, 7:05am UTC](https://forum.codewithmosh.com/t/getting-a-build-failed-error-in-clion/29455/1 "2024-10-26T07:05:37Z")

</div>

I am facing an issue in Clion while going through the C++ tutorial - Ultimate C++ Part 1: Fundamentals. In the chapter “Generating Random Number” after compiling, I am getting am error “Build Failed” while I am executing the code. Below is the code that I am compiled:

* * *

#include   
#include   
#include

using namespace std;

int main() {  
const short MaxValue = 6;  
const short MinValue = 1;

```
srand(time(0));
short first = (rand() (MaxValue - MinValue +1)) + MinValue;
short second = (rand() (MaxValue - MinValue +1)) + MinValue;

cout << first << ", " << second;

return 0;

```

}

* * *

Any idea how to solve it:

 ![Capture 1](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/7/7f3dc7d77647ca4493d839b91eed46119e5784dd.png)

---

<div class="post-metadata">

**Author:** ![POMPOMBALLS](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/pompomballs/32/6610_2.png) [@POMPOMBALLS](https://forum.codewithmosh.com/u/POMPOMBALLS)\
**Post date:** [October 26, 2024, 10:19am UTC](https://forum.codewithmosh.com/t/getting-a-build-failed-error-in-clion/29455/2 "2024-10-26T10:19:50Z")

</div>

> [@Subho2024](#):
>
> ```auto
> short first = (rand() (MaxValue - MinValue +1)) + MinValue;
> short second = (rand() (MaxValue - MinValue +1)) + MinValue;
> 
> ```

There is no modulus (`%`) operator in between.

Syntax:  
`rand() % value;`

---

<div class="post-metadata">

**Author:** ![Subho2024](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@Subho2024](https://forum.codewithmosh.com/u/Subho2024)\
**Post date:** [October 26, 2024, 10:41am UTC](https://forum.codewithmosh.com/t/getting-a-build-failed-error-in-clion/29455/3 "2024-10-26T10:41:21Z")

</div>

Thanks for the help.
