Can't build with libusb. ‘_Atomic’ does not name a type - c++

I am attempting to use libusb for a project and my C++ is rusty. I think I've resolved the dependencies for libtool and libdev on my ubuntu box, but now when I run, I get the following error.
/usr/lib/gcc/x86_64-linux-gnu/10/include/stdatomic.h:40:9: error: ‘_Atomic’ does not name a type
I found How to include C11 headers when compiling C++ with GCC?, but not sure how this helps me.
The problem appears to be in gcc somehow, but not sure how to go about fixing it. I'm using C++ 20 in CLion.

I'm running on Ubuntu and I had tried
sudo apt install libusb
to no avail. On a hunch I tried
sudo apt install libusb-dev
And it worked, so now I don't need to build it.
I need to remember to search for the library name if it isn't obvious.

Related

Why doesn't curl-config --cflags print libcurl's header files directory?

I'm trying to include libcurl in my c++ project, and so am trying to find where the header files are located, but running "curl-config --cflags" just prints an empty line, instead of any useful information. I do have libcurl installed, not only because curl-config is included in libcurl and doesn't throw an error when calling it, but running "sudo apt-get install libcurl4" tells me it's already installed, and is the latest version.
I've tried googling this problem but haven't found anyone else with the same issue, I've run "sudo apt-get upgrade libcurl4" and "sudo apt-get update" and still get the same issue, and I've run out of ideas. Does anyone know what the problem might be?
My operating system is Linux Mint Cinnamon. Let me know if you need other info. Thanks!
I believe S.M. found the answer, which in hindsight I should have tried. Apparently, my system already had the necessary header files in its default include paths, meaning there would be no path to include, hence the blank line. I probably should have tested this by seeing if my code completion software detected it, I would've saved the headache! :) For the sake of future programmers with this issue, here's the takeaway: test to see if a library is installed already first, THEN try to install it! Thanks S.M. for the help!

Boost: std_interoperability.hpp error: ‘std_category’ does not name a type

While I was trying to compile some C++ project on a fresh Ubuntu 20.04 installation, CMake complained that it couldn't find Boost at some point.
So I've installed it using
sudo apt-get install libboost-all-dev
Now when I'm trying to compile the project, the compilation of some transitive dependency fails with the error message
/usr/include/boost/system/detail/std_interoperability.hpp:88:22:
error: ‘std_category’ does not name a type
88 | static const std_category generic_instance( &cat, 0x1F4D3 );
|
The gcc version that I'm using is 9.3.0, the cmake --version is 3.16.3. The project itself should be more or less "fine", in the sense that it builds on at least one another machine; So, it must be something with the way I've installed the boost library locally.
I'd appreciate any hints about what could have gone wrong here and how to fix it.
I also see that it's not exactly an mcve (the non-reproducibility of the build, as well as the fact that something breaks in a transitive dependency are exactly my main problems right now), so I'd also greatly appreciate any hints on how to convert it into something reproducible, so that I can improve the question.

Link error: "Cannot find -ltinfo" on Ubuntu 12.04 on a 32-bit arm processor

I get the following link error when I'm compiling a small function using ncurses for an Ubuntu 12.04 running on arm. The error is
arm-linux-gnueabihf/bin/ld: cannot find -ltinfo
A lot of hints are floating around on what to install, but I can't seem to find any packages that does the trick for my arm box.
I have done
sudo apt-get install libncurses5-dev
And this does not contain the tinfo library. Other suggestions usually result in the library is "not available but referred by another package" or "has no installation candidate".
All help is appreciated
/Henrik
As mentioned by lucasg
sudo apt-get install libtinfo-dev
solved the same problem for me.
When you cross compile the nurses library, configure this option --with-termlib. It shall install libtinfo into your target location.

Boost "no such file or directory"

I'm trying to set up my Code::Blocks work environment on a new computer and I'm having some problems. It's been a long time since I first did this, and now when I open my major project Boost is causing me problems.
I'm fairly new to C++ still and fixing this type of problem is something I have limited experience with.
When I open my project and try to compile it, I get this error:
fatal error: boost/algorithm/string.hpp: No such file or directory|
At this part of one of my header files:
#include <boost/algorithm/string.hpp>
I placed the Boost v1.51.0 library at C:\boost since that is where I'd had it on my other computer. My project is set to search that directory for additional includes but it doesn't seem to be finding the files?
My project used an older version of Boost previously but I doubt that's an issue.
I'm not sure how difficult it is to debug this problem with this limited information so if there's anything else I can provide please let me know.
I'm using Code::Blocks, and have just set up minGW and Visual C++ 2010.
In Ubuntu use
sudo apt-get install libboost-dev
Ensure that you have installed boost-devel package
In Centos execute as root:
yum install boost-devel
then
root#centos6 /]# find / -name boost
/usr/include/boost
/usr/lib64/boost
[root#centos6 /]#

How to port a Ubuntu C++ library to MinGW?

In Ubuntu, there is a package called uuid-dev. To install and use it, I just need to run apt-get install uuid-dev. However, in MinGW, I couldn't install this package using mingw-get install.
May I know what are the basic steps to port a C++ application/library from Ubuntu to MinGW?
It might already support compilation under MinGW. Generally you would download the source, unpack them and run ./configure and see what happens.
Give that a try and get back to me.