visual-c++

Why we do need constructors? [closed]

北城以北 提交于 2021-02-16 13:58:06
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 9 years ago . Today my friend asked me, why really do we need constructors in C++? Where as we can do the same in structural language. What is the

fatal error LNK1104

浪子不回头ぞ 提交于 2021-02-16 07:24:49
问题 When I compile my code in visual studio c++ 2008 I get the following error: fatal error LNK1104: cannot open file 'C:\Users\...\Documents\Visual Studio 2008\Projects\...\Debug\....exe I just copied my code from another project in visual studio C++ and pasted it in this project again in VS C++. Can it cause this error? 回答1: This can happen because, for example, the executable is currently executing or opened by another program, or because you don't have the right permissions for that directory

How to design a template class with switchable member variables at compile-time in C++?

老子叫甜甜 提交于 2021-02-11 18:21:32
问题 | ■ Probelm definition____________________ I'm trying to design a super-flexible, but memory efficient module satisfying below properties. It can switch OFF unnecessary member variables depending on the situation. Which variables it will own are determined at the compile-time . I somehow made one which determines its member list " before " the compile-time , using macros and enumerator flags . see below : ▼ TraitSwitch.h #pragma once // Macros to switch-off source codes themselves. #define ON

How to design a template class with switchable member variables at compile-time in C++?

此生再无相见时 提交于 2021-02-11 18:21:08
问题 | ■ Probelm definition____________________ I'm trying to design a super-flexible, but memory efficient module satisfying below properties. It can switch OFF unnecessary member variables depending on the situation. Which variables it will own are determined at the compile-time . I somehow made one which determines its member list " before " the compile-time , using macros and enumerator flags . see below : ▼ TraitSwitch.h #pragma once // Macros to switch-off source codes themselves. #define ON

Visual c++ load rtf document contains images and text in richedit box?

岁酱吖の 提交于 2021-02-11 18:19:22
问题 I am currently working on a project. I have an rtf file which contains some text and images both. I need to display those images and text from rtf to richtextbox in Visual C++. We are not using .Net frameworks or MFC's so everything is in Visual C++ only. I do'nt have any idea how to do it. If anyone can guide me then it will be really helpful. Thanks in advance. 回答1: RichTextBox cannot load HTML. It can load only RTF or plain text. There are 3rd party components that can convert HTML to RTF,

Visual c++ load rtf document contains images and text in richedit box?

折月煮酒 提交于 2021-02-11 18:18:20
问题 I am currently working on a project. I have an rtf file which contains some text and images both. I need to display those images and text from rtf to richtextbox in Visual C++. We are not using .Net frameworks or MFC's so everything is in Visual C++ only. I do'nt have any idea how to do it. If anyone can guide me then it will be really helpful. Thanks in advance. 回答1: RichTextBox cannot load HTML. It can load only RTF or plain text. There are 3rd party components that can convert HTML to RTF,

NVCC overriding a MSVC flag (EHs)

懵懂的女人 提交于 2021-02-11 15:17:30
问题 To compile my source correctly on Windows, I need to pass the EHs flag to MSVC. This is usually straight forward: cl -EHs -c ... When building for GPU acceleration, I need nvcc to pass this flag along when it invokes cl under the hood. I simply do: nvcc -dc -ccbin cl -Xcompiler -EHs ... yet cl throws a warning: warning C4297: 'someFuncInMyCode': function assumed not to throw an exception but does note: The function is extern "C" and /EHc was specified It seems cl receives the flag EHc ,

NVCC overriding a MSVC flag (EHs)

99封情书 提交于 2021-02-11 15:16:39
问题 To compile my source correctly on Windows, I need to pass the EHs flag to MSVC. This is usually straight forward: cl -EHs -c ... When building for GPU acceleration, I need nvcc to pass this flag along when it invokes cl under the hood. I simply do: nvcc -dc -ccbin cl -Xcompiler -EHs ... yet cl throws a warning: warning C4297: 'someFuncInMyCode': function assumed not to throw an exception but does note: The function is extern "C" and /EHc was specified It seems cl receives the flag EHc ,

How to download, build and include PDCurses in Visual Studio 2019 for C++ on Windows

只谈情不闲聊 提交于 2021-02-11 15:14:24
问题 I'm fairly new to C/C++ but have never tried to include external libraries before in my projects as I've mostly been doing tutorials and such. These have been mostly console applications/games. When I was looking for an alternative to the "evil" system(" ") commands I was pointed to Curses. Now I've gone to the GitHub for both branches of the PDCurses source library (wmcbrine's branch and Bill-Gray's Branch) but every time I try to build library it returns multiple errors (happy to provide a

Inversion of generated vtable functions order for functions with the same name

本小妞迷上赌 提交于 2021-02-11 13:56:38
问题 If, using Visual Studio 2019, I compile this C++ code with two virtual methods having the same name but different arguments: struct MyStruct { virtual void foo(float) = 0; virtual void foo(int) = 0; }; class MyClass : public MyStruct { public: void foo(float) {} void foo(int) {} }; static MyClass c; The order of methods in the generated class' vtable is inverted. Here is the output in https://godbolt.org const MyClass::`vftable' DQ FLAT:const MyClass::`RTTI Complete Object Locator' ; MyClass: