Tag Archives: C

[C]fatal error: mysql.h: No such file or directory

Environment: under the Linux distribution of windows system, Ubuntu 20.04.2 lts;

Problem Description: MySQL C API programming, after installing MySQL C development library, sudo apt install default libmysqlclient dev , compile version. C file: GCC version. C - O version. O
version. C is as follows:

#include <mysql.h>
#include <stdio.h>

int main(int argc, char **argv)
        printf("MySQL client version: %s\n", mysql_get_client_info());


report errors:

version.c:1:10: fatal error: mysql.h: No such file or directory
    1 | #include <mysql.h>

Problem reason: no header file path parameter, unable to address
problem modification: Where is MySQL find mysql. H path: /usr/include/MySQL
recompile: GCC version. C - O version. O - I/usr/include/MySQL
report error again:

/usr/bin/ld: /tmp/ccEn7kBU.o: in function `main':
version.c:(.text+0x14): undefined reference to `mysql_get_client_info'
collect2: error: ld returned 1 exit status

Cause of the problem: no lib parameter is added, so the function cannot be referenced
problem modification: GCC version. C - O version. O - I/usr/include/MySQL - lmysqlclient
problem solving.

_ASSERTE((unsigned)(c + 1) <= 256);

_ Asserte ((unsigned) (c + 1) & lt; = 256);

when using VS2010 to write a program, it is a very simple program, but when inputting Chinese characters, the following error prompt appears.

at the beginning, I was obsessed with the “cannot find or open the pdb file” of the error prompt, but later found that it was not the problem there. I started to notice the following problems.

click Retry, and a breakpoint message will appear.

next, click interrupt, and the breakpoint information will appear.

it can be seen from the figure that this is one of the problems in isctype. C file.

the solution is to right-click on the project – properties – configuration properties – C/C + + – command line

and then enter “/ J”

in the input box on the lower right side to re-enter Chinese characters. It is found that the error has been solved.

reference: msdn.microsoft.com

note: for other editors, such as VS2005, 2008 and 2012, you can choose from the top of the above website. As shown in the figure below

Vs2013 error msb8031 solution today ran a MFC program, found that the error: error msb8031: building an MFC project for a non-U

Vs2013 error msb8031 solution

Today, in the process of porting and compiling, we found an error: error msb8031: building an MFC project for a non Unicode character set is decoded

You must change the project property to Unicode or download an additional library.  


go to the Microsoft website to download this component https://www.microsoft.com/zh-cn/download/details.aspx?id=40770

Select the corresponding language. Microsoft removed the multi byte character set support in vs2013,

Gcc compiler warning solution: “extra tokens at end of ifndef directive” Tags: GCC, warning

Recently, after checking all the warnings in the project, we found an interesting warning: “extra tokens at end of ifndef directive”. Literally, “there are invalid instructions after ifndef.”. I wrote a small program verification in private, and found that there are two situations that can generate this warning.

Procedure 1:

// directive_1.c
#include <stdio.h>

#ifndef MIN
  #define MIN(x, y) ((x) > (y) ? (y) : (x)) 
#endif /**/x

int main()
	printf("min val = %d\n", MIN(100, -1));

	return 0;

The above program intentionally adds an invalid character X after “ENDIF / * * / and compiles with GCC with – wall parameter as follows:
GCC directive_ 1. C - wall - O out1
an alarm is generated immediately:

directive_1.c:5:12: warning: extra tokens at end of #endif directive [-Wendif-labels]
 #endif /**/x

I was immediately shocked. Such an obvious “error” problem was that GCC was just a warning, and generated an executable binary file to execute . / out1 . The result was normal, and the effect was as follows:

min val = -1

Procedure 2:

// directive_2.c
#include <stdio.h>

#ifndef MIN
  #define MIN(x, y) ((x) > (y) ? (y) : (x)) 

int main()
	printf("min val = %d\n", MIN(100, -1));

	return 0;

Remove the redundant “X” above, and the compilation will be completely normal. As follows:

[email protected]:extra-tokens-at-end-of-#ifndef-directive$ gcc directive_2.c -Wall -o out1
[email protected]:extra-tokens-at-end-of-#ifndef-directive$ 

After further divergence of the possible situation after ifndef, it is found that there is another situation that can cause this alarm.

Procedure 3:

// directive_3.c
#include <stdio.h>

#ifndef MIN(x, y)
  #define MIN(x, y) ((x) > (y) ? (y) : (x)) 

int main()
	printf("min val = %d\n", MIN(100, -1));

	return 0;

Execute the command “ GCC directive"_ 3. C - wall - O out3 , this alarm also magically appears, as follows:

[email protected]:extra-tokens-at-end-of-#ifndef-directive$ gcc directive_3.c -Wall -o out3
directive_3.c:3:12: warning: extra tokens at end of #ifndef directive
 #ifndef MIN(x, y)

The reason is that the preprocessing of # ifndef in C language only checks the keywords, and the “(x, y)” after it is considered as redundant characters. If the brackets are removed and written as # ifndef min , there will be no alarm.

After installing CodeBlocks, run the prompt: tried to run compiler executable ‘C: / / MinGW / bin / mingw32- gcc.exe ‘, but failed!

Goto “Settings->Compiler…->Global compiler settings->GNU GCC Compiler->Toolchain executables” and fix the compiler’s setup.

Tried to run compiler executable ‘C:\MinGW/bin/mingw32- gcc.exe ‘, but failed!

Nothing to be done (all items are up-to-date).


Contact C for the first time, run the code after installation and report the above error, which means:

An attempt was made to run the compiler executable ‘C’:’mingw / bin / mingw32 ‘- gcc.exe ‘but failed!

The reason is that the compiler location cannot be found. The solution is as follows:


Auto detect: automatic detection

Then run it again

Mount windows NTFS partition under Linux

Mounting the Windows NTFS partition under Linux

How it works: Use the mount command to mount the partition under Windows into a directory under Linux.

1.uname -r View the current Linux kernel version.

2. Go to
http://www.linux-ntfs.org/ Download the same NTFS patch as the kernel version.

3. Install patch: RPM – the ivh kernel – the module – NTFS – 2. 7.0.x.x – x – 2.1.20-0. Rr. 4.10 i686. RPM

4. Use fdisk-l to view the partition information of the hard disk.


: mkdir/MNT /c corresponds to the C disk

mkdir/MNT /d corresponds to D disk

mkdir/MNT /e corresponds to e disk

6.mount -t NTFS /dev/xxx/MNT /x
6.mount -t NTFS /dev/xxx/MNT /x
6.mount -t NTFS /dev/xxx/MNT /x

: mount /dev/hda1/MNT /c

the mount -t NTFS/dev/hda5/MNT/d

the mount -t NTFS/dev/hda6/MNT/e

Vs2015 + PCL. 1.8.1 (win10) environment configuration

This weekend did nothing, from Friday night to install the PCL library, the whole is really want to cry, again and again, every time there are dozens of even hundreds of new problems, obviously in accordance with the previous install version 1.8.0 method, I do not know what is wrong. Then on Saturday night to give up to go back to sleep, do not know what they have done, suddenly good, even before 1.8.0 encountered VTK can not use the problem is also solved, happiness comes too TTTTTTTTTTT suddenly !!!!!!!!!
I have also looked at the installation tutorials of many blogs, although they are all similar, but who can guarantee that there may be a place that does not fit and cause problems. Suffice it to say, the way to get yourself installed successfully is the right way. Here is a record of my final successful installation process, for your reference.
Install pcl1.8.1
First, download the pcl1.8.1 installation package for installation, the installation package can be found on the Internet.
Here attached my links: https://pan.baidu.com/s/1-dPRLZ1a8Ktemo2EGXU-Sw extraction code: 66 rb. I have 64 bits here. Here 32-bit or 64-bit depends on how many bits your VS compiler has, not the operating system.
I am selecting the second option, automatically generating system variables, modifying the installation directory, and customizing the installation in C:\pcl1.8.1.


Solution of VS2008 unable to open GL / glaux. H header file

2011-04-15 wcdj
I don’t know why there is no OpenGL header file in SDK after VS2008. Here is a summary for this problem.
In Lesson 6 of learning Nehe’s texture mapping, I initially needed to use the header file containing gl/glaux. H, but found that I didn’t have this header file on my system. There are two header paths in the compiler that reference OpenGL:
C:/Program Files/Microsoft SDKs/Windows/v6.0 A/include/gl/gl h (the default)
C:/Program Files/Microsoft Visual Studio 9.0/VC/include/gl/glut. H (the new gl manually folder)

Googled the solution.

thod 1: Find the most used solution, but I do not have VS2003 or VS2005 installed on my system, so I cannot copy it.
I have been porting old openGL program to VS2008. I have solved the problem by copying the “include/gl/glaux.h” and “lib/glaux.lib” from the VS2005 Platform SDK located on “C:/Program Files/Microsoft Visual Studio 8/VC/PlatformSDK” To the PlatformSDK of VS2008 located on “C:/Program Files/Microsoft SDKS /Windows/ V6.0a “

Based on the reply to https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1065518& SiteID=1, it looks like glaux. Lib is deprecated. Instead link to kernel32.lib, user32.lib, gdi32.lib and advapi32.lib

The easiest way to sort this out is to:
) Install Glut3.6 or newer as directed.
2>pen Visual Studio 2008 and create a new project
3) Cho>C ++ -Empty solution
4) Import Al> the files from your previous OpenGL project
5) delete all headers i.e.
#include < gl/glu.h>
#include < gl/gluax.h>
and any other GL headers
6) then replace with #include < gl/glut.h>
7) recompile.

this worked for all of my 2003 & 2005 Solutions.

thod 4: Download Missing Files.
1: download the source CSDN download
OpenGL installation package download required documents:

http://d.download.csdn.net/down/2560229/ssagnn23 include:
GL. H GLAUX. H GLU. H glut.

VS2008 without GL. H, H, glu.h, GLAUX. Lib, glu32.lib, opengl32.lib.

1) Copy GLUX. DLL, GLUT32.DLL, GLU32.DLL and GLU32.DLL to C:/WINDOWS/system32, which should already have OpenGL32.DLL and GLU32.DLL.
. (2) the GL H, GLAUX. J H, glu. H, glut. H a copy to the C:/Program Files/Microsoft Visual Studio 9.0/VC/include/GL
. (3) the GLAUX LIB and Glu32. LIB, glut32. LIB, Opengl32. LIB, C:/Program Files/Microsoft Visual Studio 9.0/VC/lib

nehe SRC – cn – nehe OpenGL tutorials Chinese version and the code download

http://code.google.com/p/nehe-src-cn/downloads/list nehe OpenGL tutorial Chinese version and the code download

http://www.yakergong.com/nehe/ provides each Lesson # sample code and the file you need.

4 according to the method, after downloading the file and configure, recompile, without the previous mistakes, documents found, but the following mistakes.
error C2664: “auxdibimageLoadw” : Cannot convert parameter 1 from “char *” to “LPCWSTR”
is is because I am building a Unicode character set based project, so I want to use wide characters. It is also possible not to use Unicode character sets in the property page ->; Configure properties ->; You can modify it in general. Select not to use the Unicode character set here; that is, select Unset. And then recompile it. OK!


missing glaux. H in v6.0 a SDK?

http://social.msdn.microsoft.com/Forums/en/windowssdk/thread/b66e5f7a-91f6-4dbe-b388-0c131008b08f project under VS2003 under VS2008 compilation, however, Can’t find the gl/glaux. H

http://topic.csdn.net/u/20070930/15/6a900f21-8e41-4325-862f-f6df3a425f36.html VS 2008 OpenGL configuration

http://lujun5918.blog.163.com/blog/static/287227712011013114410553/ Load images generated texture opengl program

C language program running results flash back how to do

Learn to compile C language friends may encounter such a problem, program debugging when there is no error, but when running the results will find that the program results flash back, resulting in no results. The following solutions are given for such problems.
Take the simplest program, for example

} getchar();} getchar(); Can. It is important to note that this approach is not suitable for all programs, but we will look at the second approach next.

Method 2: & lt; 1> Start by adding the header file #include <; stdlib.h> As shown in figure
& lt; 2> Then write a line at the end of the program’s main function (system(“pause”));

Obviously, when the first method does not work, the second method can be used, and it works in all cases.

Three solutions to flash back of program running result box under vs

When writing C/C ++ programs in VS, the result box will always flash away, and you can’t see the results of the program. This is really annoying, so here are three ways to solve it
Method one:
In the return 0; Before the statement, add a getchar(); In this case, getchar will wait for input, and the result box will display the result of the program.
As shown in the figure below:

Method 2:
Add the statement system(“pause”) at the end of the program; , plus the header file #include< stdlib.h> “, which will display the results after running them and prompt you to press any key to continue.
As shown in the figure below


Method 3:
To modify the project configuration, right-click on the project, select Properties from the right-click menu, and then select “Configuration Properties –>” from the list to the left of the pop-up dialog. The linker – & gt; System “, and then in the list on the right, in the first “subsystem” value, select “Console (/SUBSUSTEM:CONSOLE)”
As shown in the figure below:

https://blog.csdn.net/rannianzhixia/article/details/66968219?locationNum=6& fps=1

Causes and solutions of black frame flashback after debugging visual studio 2017

After debugging, the black box flashes back, and the following error is displayed.

The reason:
Debugging mode at this time, the program will not be suspended, so the window will not continue to open state. So when the black box appears, it goes away.
Solution logic:
Causes the program to pause in a wait state.
Some compilers, such as Visual 6.0, perform this function automatically at the end of code execution.
Method 1: As shown in Figure 1, add a statement before the return statement: system (” pause “); System (” Pause “); Call the system pause command.
Method 2: getchar () before the return statement;

Either of the above methods can be used.
So it runs successfully.