Tag Archives: C++/C

fatal error: libusb.h: No such file or directory [How to Solve]

1. Error Messages:
In file included from /home/joes/jiao/ROS_Project/09_catkin_laser_Project/src/laser_myself/src/sick_tim310_1130000m01.cpp:2:0:
/home/joes/jiao/ROS_Project/09_catkin_laser_Project/src/laser_myself/include/laser_myself/sick_tim_common_mockup.h:42:20: fatal error: libusb.h: No such file or directory
compilation terminated.

 

2. Solution:
The original program header file is: #include <libusb.h>
Modify to: #include <libusb-1.0/libusb.h>

QGIS uses qt4.6.3 to upgrade to the version compiled by qt4.8.3


To extend functionality, upgrade the Qt version of QGIS, which can be quickly upgraded using the CMake tool.

Step 1: Type the source data path from the CMake UI, such as: D:\Projects\numbers\source
Step 2: in the CMake UI interface to Build the project path, such as: D: \ Projects \ Numbers \ Build, CMake will automatically load at this time the Build qgis engineering under the



Step 3: Click Geneate Configure to generate a new project. Then you can develop with VS

C / C + + library function (tower / tower) realizes the conversion of letter case

C/C++ library function (tolower/toupper) implements case conversion of letters

This article will introduce the library function to implement the case conversion of letters, commonly used in the type. H (c ++ is cctype) library file under the definition of function methods. First let’s look at the prototype implementation of the tolower/toupper function under C:

int tolower(int c)
{
	if ((c >= 'A') && (c <= 'Z'))
		return c + ('a' - 'A');
	return c;
}

int toupper(int c)
{
	if ((c >= 'a') && (c <= 'z'))
		return c + ('A' - 'a');
	return c;
}

And I’m going to do that with two little demos.

C implementation:

#include<string.h>   //strlen
#include<stdio.h>    //printf
#include<ctype.h>    //tolower
int main()
{
    int i;
    char string[] = "THIS IS A STRING";
    printf("%s\n", string);
    for (i = 0; i < strlen(string); i++)
    {
        string[i] = tolower(string[i]);
    }
    printf("%s\n", string);
    printf("\n");
}

Save as xxX. c file, execute: GCC-O XXX xxX. c generate execute file XXX. Operation:./ XXX



above is the implementation of C. Similarly, the implementation under C++ is as follows:

#include <iostream>
#include <string>
#include <cctype>
using namespace std;
int main()
{
    string str= "THIS IS A STRING";
    for (int i=0; i <str.size(); i++)
       str[i] = tolower(str[i]);
    cout<<str<<endl;
    return 0;
}

Save as xxx. CPP, execute g++ xxx. CPP to generate the execution file a.ut, execute a.ut, and the effect is as follows:



The demo above
implements the upper case tolower case conversion, again, the lower case toupper case conversion is the same, just replace tolower with toupper.