Tag Archives: vs

Problem solving – vs debugging window flash solution

1. Test procedure:

#include "StdAfx.h"
#include <iostream>

using namespace std;

int main()
{ 
	int radius;
	const double pi(3.14926);
	cout<<"Please input R:";
	cin>>radius;
	cout<<"R is:"<<radius<<endl;
	cout<<"S is:"<<pi*radius*radius<<endl;
	return 0;
}

2. Solutions
(1) If the operation is compile (F5), flash, you can run the program first (Ctrl+F5), will not flash.
(2) If the above methods do not work
1. Right-click Current Project – Properties
2. Select Configuration Properties – Linker – System
. Change the SUBSYSTEM configuration in System Options and select the first/CONSOLE from the drop-down menu.

Then select “Start (Not Debug) “, that is, press Ctrl +F5;
(3) or program manipulation
In a C++ file, add: system(“pause”) before the last line (return) of the program;
In the case of a C file, the program header adds a header: #include”stdlib.h”; Then add: system(“pause”) at the end of the program (before return); .
(4) Set the breakpoint, and then debug (F5), also can.

The reasons and common solutions of vs flash back on the road of C + + Learning (with reasons attached)

First of all, it’s normal to flash and go away.

Because the program statement is executed sentence by sentence, nothing makes it pause, at the speed of computer execution, of course, flash by.

What we need to do is make the system wait and pause so that it doesn’t flash back (some compilers automatically add this feature at the end of the code to prevent novice users from seeing the output).

1) add system(“pause”) before return;
Note: system() is the call to the system command; Pause command; “Press any key to continue..”

;
;
;
Note: getchar reads the next character, so it “pauses” while waiting for us to type.
It’s worth noting that sometimes you might need to add two getchar(), because the first getchar() might eat the carriage return or something like that.

3) Press Ctrl +F5 to run
Note: Ctrl +F5 is a program that debugs without debugging. It automatically “pauses” at the end of the program, so the DOS command prompt “Press any key to continue….” is added.
The little triangle we clicked on, which starts debugging (F5), does not automatically add “pause”, so it will flash past.

The above is only the idea after I consult the data to think, welcome everyone fellow middlemen to give correct, next will be very grateful!

Three solutions to command line flashback in VS

Four solutions to command line flashback in VS:

    adds loop while(1). Add getChar () to get a character from the keyboard. System (“pause”) causes the command line to say: Please press any key to continue. Right-click properties in Solution Explorer –>; Connector – & gt; System – & gt; SUBSYSTEM just select “/ CONSOLE”.

VTK (1) — compile and install

Project environment: QT+VTK+ CMAKE


The file packages used in this article are:

    visual studio 2013
    DXSDK_Jun10
    Cmake – 3.3.2 rainfall distribution on 10-12 – win32 – x86
    Qt5.7
    Qt – v – system.addin – 1 – opensource
    TBB (Thread Building Blocks)
    VTK 7.1

1. Install Visual Studio 2013 Community

    Download https://www.visualstudio.com/downloads/download-visual-studio-vs
    Select Visual Studio 2013 ->; Community 2013
    Download and install community default locations and default optional features (takes about half an hour to complete)

VTK + QT + vs compilation and installation configuration

VTK
The VTK, (Visualization Toolkit) is an open source, free software system for 3D computer graphics, image processing, and visualization. VTK is designed and implemented on the basis of object-oriented principles, its kernel is built in C++, contains about 250,000 lines of code, more than 2000 classes, but also contains several conversion interface, so you can also use VTK freely through Java, Tcl/Tk and Python various languages. VTK will be scientific experimental data such as architecture, meteorology, medicine, biology or aerospace, on the body, surface, light source and so on realistic rendering, so as to help people understand those who take the complex and often large scale digital presentation of scientific concepts or results.
purpose
The purpose of this article is to build an application development environment for VTK+ Qt +VS.
Qt version: 5.7.0
VTK version: 7.1.1
VS Version: 2013 (VC12)
Precondition: Cmake are installed in your environment, QT5.7.0 and VS2013 already configured installation, installation configuration is very simple, if there is something wrong with the configuration can refer to http://blog.csdn.net/goodtomsheng/article/details/45719205
VTK compilation and installation
1. Download VTK7.1.1http://www.vtk.org/download/, at present the website is the latest version VTK8.0.1, conservative estimates I chose VTK7.1.1 version, the download file VTK – 7.1.1. Zip, VTKData – 7.1.1. Zip.
2. Create a directory named VTK (name whatever), unzip ctk-7.1.1.zip, vtkdata-7.1.1.zip into VTK directory, and create a vtk_bin_x64 directory to store the generated VTK project after CMake, the directory structure after unzip is shown in the figure.

 
 
 
3. Open cmak-gui, select vtk-7.1.1 from Where is thesource code and vtk_bin_x64 from Where to build the binaries. Click Configure, select Visual Studio12 2013 in the pop-up dialog, and click Finish. After the Configue configuration is complete, there are several macros that need to be configured:
BUILD_SHARED_LIBS – Indicates whether to build a shared library or a static library. Default is the state selected for compilation. We want to build the shared library, so leave the default state.
BUILD_EXAMPLES – Indicates compilation of sample projects, selected here for easy learning.
CMAKE_INSTALL_PREFIX — After the VTK compilation is complete, the installation directory, bin, lib, include, etc., will be copied to its specified directory. The default installation directory for x64 compilation is “C:/ProgramFiles /VTK”, but the real macro is set by VTK7.1.1. INSTALL_BIN_DIR, INSTALL_INC_DIR, INSTALL_LIB_DIR, INSTALL_MAN_DIR, INSTALL_PKGCONFIG_DIR. If you are not an administrator, it will fail to install in the default directory because of permissions issues.
VTK_Group_Qt — Qt supported, not supported by default, we want to support Qt integrated development, so check this item. Also check the module_vtkguisupportQt and module_vtkguisupportQtopengl macros to support Qt.
VTK_QT_VERSION – QT version, I used to QT5 set to 5, so this option is not after the Configure, it doesn’t matter, such as the back after clicking the Generate reports QT version failed, after this time you can find this option and set to Generate was no problem.
VTK_DATA_STORE — VTK data storage location, is the previous from the VTK official website down the VTKData-7.1.1.zip, specified to decompress two layers under the directory, I here is “E:\OpenSource\ VTK \VTKData-7.1.1\VTK-7.1.1\.ExternalData”.
Module_vtkguisupportMFC – Specifies the library that will be generated to integrate with the MFC framework. I don’t need it here, so leave it unchecked.
Click Add Entry, Add CacheEntry, CMAKE_PREFIX_PATH, and set the Value to your Qt installation directory, “D:\Qt\Qt5.7.0\5.7\ MSVC2013_64”.
Click Generate when all of the above options are set. This will fail once due to the version of Qt, and it will be OK to regenerate after VTK_QT_VERSION is set correctly. After the CMAKE work is done, the interface is shown below, where the CMAKE work is finished.
 

 
 
 
4. After Generate is completed, click OpenProject to open the configured VS2013 project. Click the menu to generate ->; Batch build, select ALL_BUILD to build Debug and Release versions. After the build is complete, click on the color when the build ->; Batch build, select Install to build Debug, this will Debug version lib, bin, inlcude and other copies to the “C:/Program Files /VTK” directory set above.
5. Combine with Qt Designer, Copy the qvtkwidgetPlugin.dll and the qvtkwidgetPlugin.lib and the qvtkwidgetPlugin.exp from the bin path generated by the Release to the plugins\designer (my path is D: QT \ qt\ Qt5.7.0\5.7\msvc2013_64\) Plugins \ Designer), do not use the Debug version to compile the generated file, Qt Designer will not read it. After setup, open QTDesigner and you will see QVTKWidget, as shown in the figure below.

 
 
 
 
6. VS project configuration (the official documentation of VTK recommends using CMAKE to manage the project, here will introduce some special attention to not using CMAKE to manage the project)
A) Create a new VS project (either a Qt project or a C++ project)
C:\Program Files\VTK\ Include \ VTK-7.1 \ C:\Program Files\VTK\lib \ C:\Program Files\VTK\lib \ A good way to do this is to open a project under “Examples” and copy it directly from the project configuration input library.
C) at that time if you send the sample program code copy of the Cone to the current engineering (Cone code given below), compiled by anything, while on a running program can not run normally or hang up directly after the operation, debugging to follow up after found vtkPolyDataMapper: : New () returns NULL, and the same code Examples of instances of engineering Cone can run normally and display effect. After analyzing the Cone project, we found that it had a number of preconditioning instructions, and one of the key preconditioning instructions was:
VtkRenderingCore_INCLUDE = “E:/OpenSource/VTK/vtk_bin_x64 CMakeFiles/vtkRenderingCore_AUTOINIT_vtkInteractionStyle_vtkRenderingOpenGL2. H”.
Vtkrenderingcore_autoinit_vtkinteractionstyle_vtkrenderingopengl2.h copy to vtkinteractionstyle_vtkrenderingopengl2.h indluce directory, and then add the preprocessor to your own VS project:
vtkRenderingCore_INCLUDE=”vtkRenderingCore_AUTOINIT_vtkInteractionStyle_vtkRenderingOpenGL2.h”
To see what the preprocessor does, open the.h file and see that it defines only one macro:
# define vtkRenderingCore_AUTOINIT2 (vtkInteractionStyle vtkRenderingOpenGL2), is actually the initialization VTK module, according to the official specification, can define this macro before all include files:
# define vtkRenderingCore_AUTOINIT2 (vtkInteractionStyle vtkRenderingOpenGL2), which can solve the problem. Or, as follows, at the very beginning of the code, before all the header files are included.
#include “vtkAutoInit.h”
VTK_MODULE_INIT(vtkRenderingOpenGL2); // VTK was built withvtkRenderingOpenGL2
VTK_MODULE_INIT(vtkInteractionStyle);
Either of the above methods can solve the problem. More detailed explanation can refer to http://www.vtk.org/Wiki/VTK/VTK_6_Migration/Factories_now_require_defines. The results of the Cone project are shown below. The window closes automatically after the Cone is rotated for a few seconds.

Compiled libraries address: https://pan.baidu.com/s/1pLMChzP wfd6
 
 
 

#include "vtkConeSource.h"
#include "vtkPolyDataMapper.h"
#include "vtkRenderWindow.h"
#include "vtkCamera.h"
#include "vtkActor.h"
#include "vtkRenderer.h"
int main()
{
  // Next we create an instance of vtkConeSource and set some of its
  // properties. The instance of vtkConeSource "cone" is part of a
  // visualization pipeline (it is a source process object); it produces data
  // (output type is vtkPolyData) which other filters may process.
  vtkConeSource *cone = vtkConeSource::New();
  cone->SetHeight( 3.0 );
  cone->SetRadius( 1.0 );
  cone->SetResolution( 10 );
  // In this example we terminate the pipeline with a mapper process object.
  // (Intermediate filters such as vtkShrinkPolyData could be inserted in
  // between the source and the mapper.)  We create an instance of
  // vtkPolyDataMapper to map the polygonal data into graphics primitives. We
  // connect the output of the cone souece to the input of this mapper.
  vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();
  coneMapper->SetInputConnection( cone->GetOutputPort() );
  // Create an actor to represent the cone. The actor orchestrates rendering
  // of the mapper's graphics primitives. An actor also refers to properties
  // via a vtkProperty instance, and includes an internal transformation
  // matrix. We set this actor's mapper to be coneMapper which we created
  // above.
  vtkActor *coneActor = vtkActor::New();
  coneActor->SetMapper( coneMapper );
   // Create the Renderer and assign actors to it. A renderer is like a
  // viewport. It is part or all of a window on the screen and it is
  // responsible for drawing the actors it has.  We also set the background
  // color here.
  vtkRenderer *ren1= vtkRenderer::New();
  ren1->AddActor( coneActor );
  ren1->SetBackground( 0.1, 0.2, 0.4 );
  // Finally we create the render window which will show up on the screen.
  // We put our renderer into the render window using AddRenderer. We also
  // set the size to be 300 pixels by 300.
  vtkRenderWindow *renWin = vtkRenderWindow::New();
  renWin->AddRenderer( ren1 );
  renWin->SetSize( 300, 300 );
  // Now we loop over 360 degrees and render the cone each time.
  int i;
  for (i = 0; i < 360; ++i)
  {
    // render the image
    renWin->Render();
    // rotate the active camera by one degree
    ren1->GetActiveCamera()->Azimuth( 1 );
  }

  //
  // Free up any objects we created. All instances in VTK are deleted by
  // using the Delete() method.
  //
  cone->Delete();
  coneMapper->Delete();
  coneActor->Delete();
  ren1->Delete();
  renWin->Delete();

  return 0;
}

 
 
 
 
 
 
 

Opencv: the application can’t start normally

Compiling environment:
Operating system: Win8.1 64-bit
IDE Platform: Visual Studio 2013 Ultimate

Today on opening the.exe file generated by VS: The application cannot start properly 0xc000007b solution
It seems that the configured x86 OpenCV file may not run under x64 system (I am not sure whether this is the reason, because I have been doing this before without any problems).
Finally, it is possible to run the generated executable with the following method:
(1) Change x86 in the previously configured OpenCV path to x64
Debug:
1. Project ->; Configure properties ->; Conventional – & gt; Use of MFC: Use MFC in static libraries.
2. Project ->; Configure properties ->; C/C++-> Code generation ->; Runtime: Select multithreaded debugging (/MT).
3. When compiling, select Release, x64
Release:

1. Project ->; Configure properties ->; Conventional – & gt; Use of MFC: Use MFC in static libraries
2. Project ->; Configure properties ->; C/C++-> Code generation ->; Runtime: Select multi-threaded debugging (/ MTD).
3. When compiling, select Debug and Win32

Problems in using vs2017

Problems encountered in the use of VS2017. Only take notes, if there is infringement contact delete.
1. The default default.js or.vbs is missing when MFC adds classes to the interface. Microsoft Visual Studio2017\Community\Common7\IDE\VC\VCWizards\CodeWiz\MFC Move on to the great essay.
2. In the process of learning, the problem of “unable to start the program, denied access” suddenly appeared. After searching, it was found that it was because a game was started. After rebooting, it was fine.

3. Create new forms and pass values between forms.
1. Adding a class after adding a form is a good way to create a new form.
Open the new form code:

FileInformation dlg = new FileInformation();
dlg.DoModal();

2. Passing values between Windows should pay attention to:
1) use extern keyword to redefine the file in which the function is to be called;
2) Cannot assign initial values to variables.

Vs error prompt: “unable to open source file XXXX. H” possible reasons and Solutions

Unable to open source file xxx.h
Symptoms cause medicine friendship hint

symptoms
When learning the teacher’s example code, I found an error.

udaoplaceholder0
clock function and clock_t type are undefined identifiers?

see the library reference can not find the header file, tip “unable to open the source file time. The h”
The cause of
The code given by the teacher is not wrong in theory, it should be the problem of my development environment.
So my first reaction was: VS is broken?Can’t find time.h?Do I need to change the IDE configuration?Find the location of the header file to add?

Reference
VS cannot open source file “XXX. H”
10:57:14 on June 8, 2016 May the peace of the world Mr. W read number: 16405

https://blog.csdn.net/u014800094/article/details/51611636 project properties – & gt; Configure properties ->; C/C + + & gt; Conventional – & gt; Additional include directory ->; $(ProjectDir)

I tried it, but it was no use.
I think again, this project is written by the teacher VS2005, I am now 9012 years old, using VS2017 to open, is it possible that the version difference caused the problem! ?
Baidu, sure enough, I found someone with the same problem as me.

ah

ISDEV : fatal error -6109: Internal build error

To use InstallShield2015 Premier and installshields to shields up to the last occurrence of “ISDEV: Fatal error-6109: Internal build error”.

But create a new project and drag a few files into the project without prompting
Step by step, the problem was found that all files in the project with error-1069 prompt were deleted, and the prompt disappeared
Later, I added DLLS that were not dependent on other libraries to the project first, and then added DLLS that were dependent on other libraries. After several rounds of adjustment, it was normal at last
InstallShield has all these years of products have this problem

supplement:
later I will Options -> .NET -> In default.net Scan At Build Component Setting, the option is changed to None, (as shown in the figure below)
delete all files in the project again, add them again, and Build again. is OK

About 1 > link: fatal error lnk1168: unable to open… Exe or… DLL for writing

When we run our program with the VS compiler, there may be some questions about 1> LINK: Fatal Error LNK1168: Cannot open… DLL for writing or 1& GT; LINK: Fatal Error LNK1168: Cannot open… Exe to write, this is mainly because the process already exists, we can end the process of the program, we can open the “process Manager”, Ctrl+Alt+ DELETE key combination, and then find the corresponding process right-click to end.