Tag Archives: C/C++

Compiler error message: cs1056: unexpected character handling

Error generation:
always returns an error when compiling a pre-existing program code using VS2015. strange In some added to the end of the class file some [] [] [] [], prompt Unexpected character, ‘application error.

A compilation error as shown in the title was caused by a special full-corner character in C# code. > special full-corner characters are not displayed and saved in UTF-8 format, and the compiler cannot correctly recognize such characters, resulting in compilation errors.

solution:
set the file open mode of VS 2015, make it contains a file with the Angle of all special characters use utf-8 format to open.
>
1) In Solution Explorer, select the file that needs special opening. 2) Right-click the mouse button to pop up the menu, select “Open Mode”, and use “Charp Editor with Encoding” to open.

Reproduced in: https://blog.51cto.com/studybao/2048899

Three methods of referencing DLL in Visual Studio 2015

Copy the DLL file to the directory where the executable is located
 
2. Transfer engineering attributes ->; Configure properties ->; Debugging – & gt; Change the working directory to the directory where the DLL files reside
 
3. Transfer engineering attributes ->; Configure properties ->; Debugging – & gt; Set the environment to the Path= DLL directory, for example: Path=$(SolutionDir)bin
 

Reproduced in: https://www.cnblogs.com/buyishi/p/10236780.html

Configure OpenGL development environment (vs2015)

Configuring the OpenGL development environment (VS2015)
There are a lot of configuration VS + OpenGL tutorials online, for the configuration of the super treasure of the good and bad are mixed, mainly the official website did not give a good compiled library, many need to compile their own, so for beginners, it is difficult to configure successfully.
 
The following is a blog post that explains the configuration process and the rationale behind it
http://www.it165.net/pro/html/201504/38164.html
 
For beginners, everyone wants to be able to run the example given in the super bible. Here I directly give several twists and turns, all kinds of files generated after compilation, according to the following configuration can be run in VS2015 super treasure in the example, to achieve development.
 
I. Required allocation of resources

Resource download: http://download.csdn.net/download/ax_hacker/10107105
The zip package contains two folders, CJBD5_CODE and OpenGL. The former contains the sample program, and the latter is the three files required for configuration.
 
Include
Lib
Dll
 

How do I configure the development environment, as I explained in a previous blog post
http://blog.csdn.net/ax_hacker/article/details/78140003
The following is the configuration process for OpenGL.
 
1, Copy the files in the DLL folder to C:\Windows\ Syswow64 and C:\Windows\System32
 
2. Create an empty project, add a source file, and configure the project properties
 
1) Put the include from the previous folder under the include directory

 
2) lib in the library directory

 
3) Linker ->; Input – & gt; Additional dependencies freeglutd.lib; GLTools.lib; freeglut.lib; glew32s.lib

A series of problems in configuring OpenGL development environment in vs2015

Since Windows 7, the OpenGL header file has been changed to the Windows SDK, so you can’t use it if you don’t install it.
more funny is, under the win10 vs2015 recompense Windows SDK installation failure, the typical pit themselves.
> VS05 and VC6 OpenGL headers are directly included in the development environment directory.

Okay, let’s get started.
: \Program Files (x86)\Windows Kits\8.1\Include\um\ GL C> Program Files (x86)\Windows Kits\8.1\Include\um\ GL
The downloaded from https://www.opengl.org/resources/libraries/glut/ glutdlls37beta. Zip , and will be. H in the directory. At the same time will glut32. Lib, glut. Lib respectively on the
C: \ Program Files \ Windows (x86) Kits \ 8.1 \ lib \ winv6.3 \ um \ x86 , C: \ Program Files \ Windows (x86) Kits \ 8.1 \ lib \ winv6.3 \ um \ x64 directory.
As for the DLL, as long as you have the graphics driver installed correctly, you can ignore it (if not, put it in the system directory or the directory where the current executable is located).
note: the above list I found from the vs2015 project configuration, there is a $(WindowsSDK_IncludePath) of environment variables, you can find winsdk related parameters from the inside.
So you can compile OpenGL programs normally.
If you need to rely on OpenGL extensions provided by a particular vendor, you will need to go to the vendor's website to download the development kit separately, such as Intel, Nvidia, AMD, IBM, etc.
The original address
Today debug OpenGl source program, compiled through, but a running tips, computer lost glut32. DLL files, not depressed, search under the Internet provide most of the practice are more, copying the file to download this file to C: \ WINDOWS \ system in 32, but did so after found that still doesn't work, after a long afternoon, suddenly realized that may be about my new WINDOWS 7 system, but also for loading is 64 - bit, then, Try to copy this glut32.dll to your SysWOW64 folder in C:\ Windows, and it will all be OK. Here's a special note to remind everyone who installed Windows 7 and VC ++ 6.0 to pay attention to it.
PS: When you first start to contact OpenGL, you will inevitably encounter some problems, these problems may have nothing to do with the program, just some compile environment Settings and the installation of header files, special sorting, as follows:
PS: When you first start to contact OpenGL, you will inevitably encounter some problems, these problems may have nothing to do with the program, just some compile environment Settings and the installation of header files, special sorting, as follows:
PS
(1) Copy gult32.dll, Glut. DLL to Windows system system32(if Windows 7 is a 64-bit operating system, it is in C:\ Windows SysWOW64 file)
(2) Copy gult32.lib, Glut. lib to VC lib directory
(3) Copy ULT. H to include\GL of VC
The original address
Introduction to OpenGL

C / C + + cannot open the source file directory, the header file is not imported, the solution is as follows

The two methods
Configure the various dependencies
1. Project, Properties, C/C++, Additional Includes Directory: Fill in Additional Includes Directory “add. H file folder path semicolon interval multiple
2.
3
3
3
3
3
3
3
3
3
3
3> Item, Property, Linker, Input, Additional Dependency: Fill in the name of the additional dependency library. Lib space or semicolon interval multiple
Two, the use of code directly import
Copy the required xxx.h file to the compile file
Copy the required copy of the xxx.lib library to the build


IntelliSense: unable to open source file ‘StdAfx. H’

-h /.cpp file: cannot open the source file “stdafx.h”, some methods found are not applicable, such as: set project properties ->; Configure properties ->; C/C++-> Precompiled header ->; Using (/Yu)/ creating (/Yc)/ not using precompiled headers does not work either way. Despite this error, the program was run successfully. The initialization and compilation runs seem to use different lookup paths, which is a problem when developed with a lower version of VS2005/VS2008 but opened with a higher version of VS2010. The solution is:
< wbr> < wbr> < wbr> < wbr> < wbr> < wbr> < wbr> < wbr> < wbr> < wbr> < wbr> Project Properties -& gt; Configure properties -& gt; C/C++-& gt; General – & amp; gt; Additional include directory -& gt; < strong> $(ProjectDir)< /strong> < /wbr> < /wbr> < /wbr> < /wbr> < /wbr> < /wbr> < /wbr> < /wbr> < /wbr> < /wbr> < /wbr>

Solution to the problem of unable to open glaux. H in vs2013

Gl /glaux. H cannot be opened. The solution is to download or copy it in the old version and put it in the directory of VS

VC6.0 C:\Program Files\Microsoft Visual Studio\VC98\Include\GL

VS2010 C:\Program Files\Microsoft SDKS \Windows\v7.0A\Include\gl

VS2013 C:\Program Files\Microsoft SDKS \Windows\v7.1A\Include\gl

1 put the lib files in the corresponding lib folder.

2 puts the.h file in the appropriate include\gl folder.

3 puts the DLL files in the system32 folder.

If it is already copied and still not available, put the corresponding header and library files in the current directory where you wrote them.
#include “GLAUX.h”

The problem of window flash after C + + program is compiled and run

Unicorns are hiring Python engineers in 2019. > >

Problem: When you first learn C++ to write Win32 Console Application using a different compiler, the resulting window may flash and disappear.
Some compilers are very good, and there are similar solutions in the example program. For example, in DevC ++, when creating a new non-empty C++ class, return 0; Before this: system(“PAUSE”); In Visual Studio there is no flash if you follow the steps, but when we press the shortcut key F5, the result will still flash. We can do this in return 0; STD ::cin.ignore(STD ::cin.rdbuf()->; in_avail()+1); That way it will show up, not just go over it. If you just want to see the result, there’s another way, and that’s in return 0; I’m going to say while(1);
Thank you @IM Xinye for reminding me. My posture has risen. When compiling, if you press F5 directly for debugging, there will be a flash of the situation. If Ctrl +F5 is not debugging, then there will be no flash.

Reproduced in: https://my.oschina.net/u/734295/blog/160510

use cin.get () instead of system (“pause”) to avoid the flash of C + + programs

C + + compiled in a separate console program execution time, often a flash, can’t see the output results, in order to solve this problem, there are a lot of people use the system (” pause “) to suspend, but so are a lot of disadvantages, there are two reasons for
a: poor portability
2: consume resources is very big, in both Windows and Linux

Instead of using system(“pause”) to pause, you can use STD ::cin.get() or getchar()
. Why not system(“pause”)?


Let’s take a look at the flow of system(“pause”)
1: Pause your program
: Start the Shell in the sub-process
3>ind commands to execute and allocate memory for them
4: Wai>r input
5: Recluse m>y
6: End the Shell <>> 7: Continue your program>

To summarize, use STD ::cin.get() or getchar() to pause the execution of a C ++ program

PS: the original http://www.gidnetwork.com/b-61.html

Reproduced in: https://blog.51cto.com/zhanggx/1305045

In vs programming, the code of Ctrl + F5 is flashback

When VS compiles and runs the code, if there is no delay or some kind of response, the window will close immediately after running
Solution a:
in the main function and getchar ()

; add system(” pause “) to the main function
Solution 3:
right-click on the project, select properties, choose the linker, selection system, in the subsystem, the console this

the above methods are debug mode, the way of carrying the shortcut Ctrl + F5
in debug mode, just set a breakpoint in the main function, then one by one to debug