visual-c++

Link issues (VC6)

I've opened an old workspace that is a libray and its test harness. It used to work fine but now doesn't and older versions of the code don't work either with the same errors. I've tried recreating the project and that causes the same errors too. Nothing seems out of order in project settings and the code generated works in the main app....

MSVC6: Breakpoint stops program - WTF?

Using Microsoft Visual Studio 98, Microsoft Visual C++ 6.0 SP6 When running under the debugger, there's only one problem. If I pause the program and resume, everything's fine. The problem? When I hit a breakpoint, my program stops. But not in a good way; execution halts, I'm thrown out of debug mode into edit mode. All's fine until...

Using GLUT with Visual C++ Express Edition

What are the basic steps to compile an OpenGL application using GLUT (OpenGL Utility Toolkit) under Visual C++ Express Edition? ...

fopen deprecated warning

On Visual Studio 2005 C++ compiler, I get the following warning when my code uses the fopen and such calls. 1>foo.cpp(5) : warning C4996: 'fopen' was declared deprecated 1> c:\program files\microsoft visual studio 8\vc\include\stdio.h(234) : see declaration of 'fopen' 1> Message: 'This function or variable may be unsafe. C...

How can an MFC application terminate itself?

What is the proper way for an MFC application to cleanly close itself? ...

Warning C4341 - 'XX': signed value is out of range for enum constant

When compiling my C++ .Net application I get 104 warnings of the type: Warning C4341 - 'XX': signed value is out of range for enum constant Where XX can be WCHAR, LONG, BIT, BINARY, GUID etc. I can't seem to remove these warnings whatever I do. When I double click on them it takes me to a part of my code that uses OdbcParameters - an...

Using an ocx in a console application

I want to quickly test an ocx. How do I drop that ocx in a console application. I have found some tutorials in CodeProject and but are incomplete. ...

Is Visual C++ memory managed by the Dot Net framework

I have recently had an issue accessing MAPI through the dot net framework (explained in this artical) that in turn has generated memory access violation errors. To get around this I opted to use a third party component from code project with a visual C++ core however we still have the problems. I have never used visual C++ myself howe...

What's the simplest way to execute a query in Visual C++

I'm using Visual C++ 2005 and would like to know the simplest way to connect to a MS SQL Server and execute a query. I'm looking for something as simple as ADO.NET's SqlCommand class with it's ExecuteNonQuery(), ExecuteScalar() and ExecuteReader(). Sigh offered an answer using CDatabase and ODBC. Can anybody demonstrate how it would b...

Output compile time stamp in Visual C++ executable?

How can I insert compilation timestamp information into an executable I build with Visual C++ 2005? I want to be able to output something like this when I execute the program: This build XXXX was compiled at dd-mm-yy, hh:mm. where date and time reflect the time when the project was built. They should not change with each successive...

Attaching to a foreign executable in Visual C++ 2003

I have an executable (compiled by someone else) that is hitting an assertion near my code. I work on the code in Visual C++ 2003, but I don't have a project file for this particular executable (the code is used to build many different tools). Is it possible to launch the binary in Visual C++'s debugger and just tell it where the sources ...

Compiler Error C2143 when using a struct

I'm compiling a simple .c in visual c++ with Compile as C Code (/TC) and i get this compiler error error C2143: syntax error : missing ';' before 'type' on a line that calls for a simple struct struct foo test; same goes for using the typedef of the struct. error C2275: 'FOO' : illegal use of this type as an expression ...

Finding out the source of an exception in C++ after it is caught?

I'm looking for an answer in MS VC++. When debugging a large C++ application, which unfortunately has a very extensive usage of C++ exceptions. Sometimes I catch an exception a little later than I actually want. Example in pseudo code: FunctionB() { ... throw e; ... } FunctionA() { ... FunctionB() ... } try...

Any recommended VC++ settings for better PDB analysis on release builds

Are there any VC++ settings I should know about to generate better PDB files that contain more information? I have a crash dump analysis system in place based on the project crashrpt. Also, my production build server has the source code installed on the D:\, but my development machine has the source code on the C:\. I entered the sou...

Recursion in Live VC++ Code

Would you use recursion in live VC++ code? ...

Portably handle exceptional errors in C++

I'm working on porting a Visual C++ application to GCC (should build on MingW and Linux). The existing code uses __try { ... } __except(1) { ... } blocks in a few places so that almost nothing (short of maybe out of memory type errors?) would make the program exit without doing some minimal logging. What are the options for doing somet...

Measuring exception handling overhead in C++

What is the best way to measure exception handling overhead/performance in C++? Please give standalone code samples. I'm targeting Microsoft Visual C++ 2008 and gcc. I need to get results from the following cases: Overhead when there are no try/catch blocks Overhead when there are try/catch blocks but exceptions are not thrown Overh...

Why is Visual Studio 2005 so slow?

It is slow to load anything other than a small project. It is slow to quit; it can sometimes take minutes. It can be slow to open new files. The record macro feature used to be useful. It is now so slow to start up it's almost always quicker to do it manually! More info would be helpful. How big are your solutions? What platform ar...

Strange Dependency Behavior in VS.NET 2005 (Unnecessary .CPP Compilation)

I work on a large Visual C++ (MFC) project in VS.NET 2005. I have noticed strange behavior in Visual C++ 2005. Often, I will change one line of code in a .CPP file but many .CPP files will compile as a result of this. I have never seen this until VS.NET 2005. Theortically, changing a line of code in a .CPP file should simply require rec...

Why is Borland C++ better than Visual C++

Why is Borland C++ better than VC++? ...