C++ #include library
Discussion
I am trying to help my lad doing some work on a C++ code that needs to use an include library; all very simple however the library he wants to use requires some work to be done before he uses it?
I am in no way a C++ cider, however I have worked out that it is the "Boost" library, "Thread" code. This bit of code is not a headers only bit of code (?)
Last night he was getting angry at the world so in the end I had to take the laptop away from him, please can anyone tell me - in idiots terms (for me!) How to do the install of the code?
Andy
I am in no way a C++ cider, however I have worked out that it is the "Boost" library, "Thread" code. This bit of code is not a headers only bit of code (?)
Last night he was getting angry at the world so in the end I had to take the laptop away from him, please can anyone tell me - in idiots terms (for me!) How to do the install of the code?
Andy
How is he building the code? Using the boost libraries is easier if using a package manager like CONAN, possibly combined with CMake.
Is the program something he has downloaded (if so it should have build/make files) or something he is writing from scratch?
If he is writing it from scratch he should be able to swa out boost::thread for std::thread
Is the program something he has downloaded (if so it should have build/make files) or something he is writing from scratch?
If he is writing it from scratch he should be able to swa out boost::thread for std::thread
Sorry - got some more details now.
He is running it in visual studio 2022
The code is Boost - from wee.boost.org
I believe it is version 1.81.0 but not sure where he got it from? Or it could be the top link on boost.org to be honest!
He has created a library on documents\VisualStudio Libraries\boost_1_81_00 which has a lot of subfiles under it.
In the code, first line is #include<iostream> which appears to work fine,
Second line is #include<boost/thread.hpp> which I think where it fails?
Error message is this:
LNK1104 cannot open file 'libbost_thread-vc143-mt-gd-x64-1_81.lib
I have placed the directory into the path folder on projects, not sure what else to do?
He is running it in visual studio 2022
The code is Boost - from wee.boost.org
I believe it is version 1.81.0 but not sure where he got it from? Or it could be the top link on boost.org to be honest!
He has created a library on documents\VisualStudio Libraries\boost_1_81_00 which has a lot of subfiles under it.
In the code, first line is #include<iostream> which appears to work fine,
Second line is #include<boost/thread.hpp> which I think where it fails?
Error message is this:
LNK1104 cannot open file 'libbost_thread-vc143-mt-gd-x64-1_81.lib
I have placed the directory into the path folder on projects, not sure what else to do?
Sorry - got some more details now.
He is running it in visual studio 2022
The code is Boost - from wee.boost.org
I believe it is version 1.81.0 but not sure where he got it from? Or it could be the top link on boost.org to be honest!
He has created a library on documents\VisualStudio Libraries\boost_1_81_00 which has a lot of subfiles under it.
In the code, first line is #include<iostream> which appears to work fine,
Second line is #include<boost/thread.hpp> which I think where it fails?
Error message is this:
LNK1104 cannot open file 'libbost_thread-vc143-mt-gd-x64-1_81.lib
I have placed the directory into the path folder on projects, not sure what else to do?
He is running it in visual studio 2022
The code is Boost - from wee.boost.org
I believe it is version 1.81.0 but not sure where he got it from? Or it could be the top link on boost.org to be honest!
He has created a library on documents\VisualStudio Libraries\boost_1_81_00 which has a lot of subfiles under it.
In the code, first line is #include<iostream> which appears to work fine,
Second line is #include<boost/thread.hpp> which I think where it fails?
Error message is this:
LNK1104 cannot open file 'libbost_thread-vc143-mt-gd-x64-1_81.lib
I have placed the directory into the path folder on projects, not sure what else to do?
That's good info.
The first answer (below the question) on this looks worth a try, making some substitutions for the version and locations you're using.
https://stackoverflow.com/questions/13042561/fatal...
The first answer (below the question) on this looks worth a try, making some substitutions for the version and locations you're using.
https://stackoverflow.com/questions/13042561/fatal...
The linker needs to know where to pick up the associated library. I'm guessing it can't get by with just a header usage of boost if it's wanting to pull in the lib folder. Find where he's picking up the boost/thread.hpp file from, that should get you into the location where the boost package is. Somewhere in there will be a lib folder that contains all the .lib files and he should be able to then find what he needs.
Bear in mind that boost is clever and will look for a version that matches the version of the compiler you are using, so it may be that you don't have a vc143 lib version available and may need to build the boost libs yourself with the version of Visual Studio being used, or find a distributable that includes it.
Once you've got the actual lib available, either prebuilt or built by yourselves, the path to the lib directory will need adding to the linker environment in the project solution properties.
Bear in mind that boost is clever and will look for a version that matches the version of the compiler you are using, so it may be that you don't have a vc143 lib version available and may need to build the boost libs yourself with the version of Visual Studio being used, or find a distributable that includes it.
Once you've got the actual lib available, either prebuilt or built by yourselves, the path to the lib directory will need adding to the linker environment in the project solution properties.
trashbat said:
That's good info.
The first answer (below the question) on this looks worth a try, making some substitutions for the version and locations you're using.
https://stackoverflow.com/questions/13042561/fatal...
I passed this on to him, and it now works! Thanks very much for posting it, I tell him (over and over) that people on the internet may know what he is trying to do but he refuses to ask!The first answer (below the question) on this looks worth a try, making some substitutions for the version and locations you're using.
https://stackoverflow.com/questions/13042561/fatal...
Of course I did take the Mickey a little bit first, which may not have helped!
Thanks again though, I have a happy son again now!
aclivity said:
I passed this on to him, and it now works! Thanks very much for posting it, I tell him (over and over) that people on the internet may know what he is trying to do but he refuses to ask!
Of course I did take the Mickey a little bit first, which may not have helped!
Thanks again though, I have a happy son again now!
You're both welcome!Of course I did take the Mickey a little bit first, which may not have helped!
Thanks again though, I have a happy son again now!
I'm a professional software engineer - not C/C++ these days though - and a key skill is, simple as it sounds, identifying the most relevant, searchable part of your problem, Googling it, and then identifying the relevant answers.
In your case, "LNK1104 cannot open file libbost_thread" turns up what I gave you.
It's obviously not the only part of the job by any means but a lot of problem solving ends up being stuff like this - especially project foundations or integrating existing things. Modern dev is complex enough such that nobody just knows all of this stuff.
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff