visual-c++

non-copyable objects and value initialization: g++ vs msvc

I'm seeing some different behavior between g++ and msvc around value initializing non-copyable objects. Consider a class that is non-copyable: class noncopyable_base { public: noncopyable_base() {} private: noncopyable_base(const noncopyable_base &); noncopyable_base &operator=(const noncopyable_base &); }; class noncopya...

MFC SDI Application without a default "New Document" on Startup

My application is an SDI with multiple views. By default, it creates a new document when the application starts. I want to modify this behavior so that a new document is created only when user explicitly clicks on "New". Or at least mimic this behavior. Any ideas? I am using Visual Studio 2008 with MFC feature pack. I googled and found s...

Why is C++ fwrite() producing larger output in release?

I recently wrote an implementation of the Canonical Huffman compression algorithm. I have a 500kb test file that can be compressed to about 250kb when running the debug and release builds from within Visual Studio 2008. However when I run the release build straight from the executeable the test file only compresses to about 330kb. I am ...

How to set which version of the VC++ runtime Visual Studio 2005 targets

I have an application that contains a VC++ project (along with C# projects). Previously, (i.e. during the last year or so) when a build has been done, Visual Studio 2005 appears to be targeting the VC++ runtime version 8.0.50727.762. At least, that is what the Assembly.dll.intermediate.manifest file is telling me: <?xml version='1.0' en...

MFC: what would be the regex to check if a character is unicode or not?

Hi All, I'm trying to use windows' API IsTextUnicode to check if a character input is unicode or not, but is sort of buggy. I figured, it might be better using a regex. However, I'm new to constructing regular expressions. What would be the regex to check if a character is unicode or not? Thanks... ...

Convert PS file to PDF in Visual C++

I need to convert (input) PS file to (output) PDF file via Visual C++. And after converting i need to display the pdf file in a window. Could any one help me in this ?. How can i proceed further ? ...

How do I inhibit "note C6311" in Microsoft C compiler?

In this maximally clipped source example, the manifest constant FOOBAR is being redefined. This is deliberate, and there is extra code in the live case to make use of each definition. The pragma was added to get rid of a warning message, but then a note appeared, and I don't seem to find a way to get rid of the note. I've been able to ...

Visual C++ program for paint brush code using openGL

hi!I want the code/program for paint brush in Visual C++ using open gl.It must include square,rectangle,triangle,circle,pencil,eraser and it must have buttons. ...

Visual Studio 2010 Linker Finding Multiply Defined Symbols (Where It Shouldn't)

I've just started with C++, and maybe there's something that I'm doing wrong here, but I'm at a loss. When I try to build the solution, I get 4 LNK2005 errors like this one: error LNK2005: "public: double __thiscall Point::GetX(void)const " (?GetX@Point@@QBENXZ) already defined in CppSandbox.obj (there's one for each get/set method, an...

How do you extract data from a Date/Time widget from a C++ MFC dialog in VS2008

This is a fairly basic question, but I haven't been able to find any from->to guides from VS6->VS2008. I have a dialog box that contains controls of various types, I've discovered the way of auto-generating OnBnClickedMyFooBarButtonHere() methods via the Properties dialog on the dialog editor. I can also use CWnd::GetDlgItemText(int ,CS...

i see the file but when i open it nothing is in it in c++ i/o stream and dont know why

#include<iostream> #include<fstream> #include<cstdlib> #include<iomanip> using namespace std; int main() { ifstream in_stream; // reads ITEMSLIST.txt ofstream out_stream1; // writes in listWititems.txt ifstream in_stream2; // reads PRICELIST.txt ofstream out_stream3;// writes in listWitprices.txt ifstream in_stream4;/...

this == null // How can it be possible?

Recently I came across some strange behaviour of my application. It has been developed mainly in C# but CLI/C++ was also used to achieve better performance. I was getting a System.NullReferenceException in a very simple method at the TimeSpan comparison: TimeSpan _timestamp; void UpdateFrame(TimeSpan timestamp) { if(TimeSpan::Equals...

Visual C++ Express resource files

I want to add icon file to my Win32 project, how to do that in VC++ Express? I created *.res file with XN Resource Editor, but I don't know what to do with it. Guess I need resource script, *.rc? What to write in that script ( probably must link *.res file that I created ). So I have *.res file, need *.rc script (don't know what to write...

How to get the drive letter of pendrive

Hi, I want to get the drive letter of pendrive or external harddisk connected through USB. Is it possible to get the Drive letter. I am using VC++ ...

atlbase.h not found when using Visual C++ Express 2010

So I tried moving my project to Visual C++ Express 2010 on Windows 7 from a previous version on Windows XP. I got all sorts of errors where atlbase.h was not found. This isn't so much a question but I wanted to document what my resolution was for others. Copied the following PlatformSDK files from my previous install and put them on m...

Does anyone know what causes this error? VC++ with VisualAssert

Hi does anyone know what causes this error? In Visual Studio 2008 with Visual Assert Thanks 1>------ Build started: Project: ChessRound1, Configuration: Debug Win32 ------ 1>Compiling... 1>stdafx.cpp 1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xlocnum(135) : error C2857: '#include' statement specified with the...

Invalidate() debug assertion failed message (MFC, VC++)

I've made a custom control, and when I want it to repaint on the screen I call Invalidate(), and afterwards UpdateWindow(), but i get message: debug assertion failed for a file afxwin2.inl in line 150 which is: AFXWIN_INLINE void CWnd::Invalidate(BOOL bErase) { ASSERT(::IsWindow(m_hWnd)); ::InvalidateRect(m_hWnd, NULL, bErase); } ...

How can I determine which dependency would cause a C++ compilation unit to be rebuilt?

I have a legacy C++ application with a deep graph of #includes. Changes to any header file often cause recompiles of seemingly unrelated source files. The application is built using a Visual Studio 2005 solution (sln) file. Can MSBUILD be invoked in a way that it reports which dependency(ies) are causing a source file to be recompiled...

Problem with "moveable-only types" in VC++ 2010

I recently installed Visual Studio 2010 Professional RC to try it out and test the few C++0x features that are implemented in VC++ 2010. I instantiated a std::vector of std::unique_ptr, without any problems. However, when I try to populate it by passing temporaries to push_back, the compiler complains that the copy constructor of unique...

VisualAssert Testing in C++, Loading a test fixture.

Good day, I am learning Testing in Visual Studio C++ and I have several tutorials which I have followed. I am trying to load a test fixture. I have tried to put the test .cpp file in many different places but it will still not pick up on it when I click on "Run Tests" or "Run Tests without debugging" In the tutorials I found, they seeme...