training icon indicating copy to clipboard operation
training copied to clipboard

[Error] Exercise : Consume Hello Package - not enough instruction on how to modify files

Open designerzim opened this issue 3 years ago • 3 comments

The commented instructions are very vague.

eg # modify conanfile.txt to account for new dependency

Had to relisten since the only guidance here is in voice, and says to use the existing format as a guide, which gives us: [requires] boost/1.72.0 poco/1.9.4 hello/0.1

The next step is also obscure: # modify CMakeLists.txt to account for new CONAN_PKG::hello

Which I assume refers to: target_link_libraries(timer CONAN_PKG::poco CONAN_PKG::boost CONAN_PKG::hello)

Finally: # modify timer.cpp to include "hello.h" and call the hello() function

The other includes have a path, but nothing is explained here, so this could be wrong: #include <hello.h>

But I assume calling hello() anywhere in main() is fine. int main(int argc, char** argv){ ... hello(); ... return 0; }

Result: $ conan install .. Configuration: [settings] arch=x86_64 arch_build=x86_64 build_type=Release compiler=gcc compiler.libcxx=libstdc++11 compiler.version=7 os=Linux os_build=Linux [options] [build_requires] [env]

hello/0.1: Not found in local cache, looking in remotes... hello/0.1: Trying with 'conan-center'... ERROR: Unable to find 'hello/0.1' in remotes

This looks like its failing from the first step, not the second or third (although it's not clear if they will work).

designerzim avatar Jun 10 '21 21:06 designerzim

Looks like we're supposed to know that hello needs the @user/channel specified and be: hello/0.1@user/testing

This is not clear, especially when looking at boost and poco as our only examples. It's only referenced on the first slide of this video.

designerzim avatar Jun 10 '21 21:06 designerzim

I had the same confusion. Following from the previous lessons I assumed that the steps would be:

  1. Open conanfile.txt and add the line hello/<versionstring> under the [requires] heading,
  2. Open CMakeLists.txt and add CONAN_PKG::hello to target_link_libraries, (goes as expected)
  3. add #include <hello/hello.h> to timer.cpp, in line with the other includes, and call hello() somewhere in main().

I got it to work by including appending the @user/channel info to conanfile.txt, and simply including hello.h rather than hello/hello.h.

Now, I would like to know what I have to do to get it to follow the convention of the other includes and have the header be included from a "hello" directory.

TheEyesightDim avatar Mar 28 '22 00:03 TheEyesightDim

Please listen carefully to the user/channel slide in the "Create package from Github source" and explanations in the video to learn about it, and also the slide with conan search hello/0.1@user/channel that will not work without using the right user/channel.

So the user/channel part should be enough covered by previous exercises.

The hello.h vs hello/hello.h, yes, maybe it makes sense to add some hint or clarification about it. The thing is that there is no universal convention, and packages from open source libraries might do a thing, and your own packages do a different thing. But yes, lets try in the next training videos to improve this.

memsharded avatar Mar 28 '22 15:03 memsharded