Cmake Tutorial Issue

I have tried searching for a solution, but I haven’t been able to find a solution that prevents the error form occurring while using the code that should build fine. This specifically pertains to Exercise 1 of Step 2 in the Cmake Tutorial. I downloaded the code being used in the tutorial from Github. I also am using cmake 3.26.1 installed on a computer running Windows 11.

With all the details, I did all the steps for Exercise 1 in Step 2 and get the error where {PATH} is the root directory that the “CMake-master”:

{PATH}\CMake-master\Help\guide\tutorial\Step2\tutorial.cxx(27,30): error

C3861: ‘mysqrt’: identifier not found [{PATH}\CMake-master\Help\guide\t

utorial\Step2\Step2_build\Tutorial.vcxproj]

After this, I reverted back to the original. I then proceeded to make one update at a time doing a copy and paste of the command from the page to make sure the issue is not being caused by a typo on my part. After each step, I would perform the “cmake --build .” command. They all created the build find until I after making the update for TODO 6, the last one. That is where it executes the library procedure mysqrt. It seems like it is not finding the library. It seems like mysqrt is not in scope. I have programming experience, but not with C++. The reason I’m trying to learn cmake is so I can compile some open source software on a Windows computer rather than Linux and it needs a library, which make this part of the tutorial important. Any help would be appreciated.

Please see this other other topic for possible solutions for your problem.

Apart from that you can compare your solution with the source of the next step, which usually includes the solution. To find out what is wrong.

I can confirm this issue still exists. It’s not a huge mistake but very confusing for beginners :innocent: :blush: Exercise 2 - Solution 6.

Solution in the online-tutorial:

const double outputValue = mysqrt(inputValue);

error: ‘mysqrt’ was not declared in this scope;

I think the solution in the comments from the tutorial specific downloaded files is right:

// TODO 6: Replace sqrt with mathfunctions::sqrt

const double outputValue = mathfunctions::sqrt(inputValue);

Thanks to you for your CMake-Tutorial! :green_heart: