c++

Can I make C++ in Visual Studio 2008 behave like an earlier version?

I need to work with some old C++ code that was developed in Visual C++ 6.0. Right now it's giving me compile errors galore. (For instance, "cannot open include file: 'iostream.h'"... because now it should say #include <iostream> rather than #include <iostream.h>). How can I work with this code without having to change it all over the ...

Qt->QGraphicsView->QGraphicsItem resizing.

I'm pretty new to QGraphicsView in Qt. As far as I can tell there is no built in way to resize a QGraphicsItem in a scene with a mouse. What I'm looking for is to be able to resize a QGraphicsRectItem by either dragging out the corners or the edges on screen. Is there a simple way to do that? Is there a library or a piece of code some...

Codegear RAD Studio C++ Go to Definition - Control Click

I am using CodeGear RAD Studio C++, I know that to go to a definition of a variable or class you must press control and click on the method name, or any identifier where you want to go to a definition. However, as most of you would notice this does not work all the time. Does anyone have any trick on doing this? ...

Visual Studio 2008, error c2039: 'set_new_handler' : is not a member of 'std'

So the other day I went to compile a VC++ project I am working on and all of a sudden I get errors in almost all of my files saying: new.h: error C2039: 'set_new_handler' : is not a member of 'std new.h: error C2039: 'set_new_handelr' : symbol cannot be used in a using-declaration "new.h" and 'set_new_handler' are not being used ...

Fast string matching algorithm with simple wildcards support

I need to match input strings (URLs) against a large set (anywhere from 1k-250k) of string rules with simple wildcard support. Requirements for wildcard support are as follows: Wildcard (*) can only substitute a "part" of a URL. That is fragments of a domain, path, and parameters. For example, "*.part.part/*/part?part=part&part=*". The...

Invert a stack, without using extra data structures?

How would you invert a stack, without using extra data structures, like a second, or temporary, stack. Thus no stack1-stack2 or stack-queue-stack implementation in the answer. You just have access to push/pop feature of a standard stack. I think there is way to do it by keeping a global counter and using pointer manipulation. ...

How do I create a file in VC++ 6.0 when UAC is on?

How do I create a file in C++ when UAC is on, but with out running as administrator? I'm trying to create a text file in the following path: "C:\Programdata\Desktop" in VC++ 6.0 when Vista's UAC is on. However, Createfile(...) failed with 'permission denied'. When I run the sample application with "run as administrator" it works. But m...

What strategies have you used to improve build times on large projects?

I once worked on a C++ project that took about an hour and a half for a full rebuild. Small edit, build, test cycles took about 5 to 10 minutes. It was an unproductive nightmare. What is the worst build times you ever had to handle? What strategies have you used to improve build times on large projects? Update: How much do you think...

Qt Creator source files

Is it possible to set up QtCreator to treat .d files as C sources? ...

Using MSHTML ATL Whats the best way to highlight parts of a web page?

Wanting to highlight stuff in web pages as you mouse over, but there seem to be so many ways you can set display properties I'm having trouble finding a good way to change the display so that it can change back and still keep close to what the user was already looking at. The IE 8 developer tools Outline tool does something like what I ...

Linker Error on having non Inline Function defined in header file?

Non inline function defined in header file with guards #if !defined(HEADER_RANDOM_H) #define HEADER_RANDOM_H void foo() { //something } #endif Results in linker error : Already defined in someother.obj file Making the function inline works fine but I am not able to understand why the function is already erroring out in first case. ...

Extending the C++ Standard Library by inheritance?

It is a commonly held belief that the the C++ Standard library is not generally intended to be extended using inheritance. Certainly, I (and others) have criticised people who suggest deriving from classes such as std::vector. However, this question: http://stackoverflow.com/questions/1038482/c-exceptions-can-what-be-null made me realise...

Overload Resolution with Two Enums

We have some code that looks roughly like this: // Two enums that differ entirely. enum A { a1, a2 }; enum B { b1, b2 }; // Functions to convert in some meaningful way between them A convert(B); B convert(A); Now, our compiler goes and does exactly what we expect it to. convert(a1) will call B convert(A), and so on. However, when w...

How do I avoid compiler warnings when converting enum values to integer ones?

I created a class CMyClass whose CTor takes a UCHAR as argument. That argument can have the values of various enums (all guaranteed to fit into a UCHAR). I need to convert these values to UCHAR because of a library function demanding its parameter as that type. I have to create a lot of those message objects and to save typing effort I ...

Error c2061 when compiling

When I compile a project I get this error: C:\DATOSA~1\FAXENG~1>nmake /f Makefile.vc clean Microsoft (R) Program Maintenance Utility Version 9.00.21022.08 Copyright (C) Microsoft Corporation. All rights reserved. cd src nmake /nologo /f Makefile.vc clean del /F *.obj *.lib *.dll *.exe *.res *.exp cd.. ...

embedded resource in c++

how do I create an embedded resource and then access it in C++? Any example on how to read the resource would be great I am using visual studio 2005 Thanks in advance Edit1: I want to put one xsd file which is required while validating schema of the recieved xml file. ...

How to write to a varchar(max) column using ODBC

Summary: I'm trying to write a text string to a column of type varchar(max) using ODBC and SQL Server 2005. It fails if the length of the string is greater than 8000. Help! I have some C++ code that uses ODBC (SQL Native Client) to write a text string to a table. If I change the column from, say, varchar(100) to varchar(max) and try to ...

Should I use double or float ?

What are the advantages and disadvantages of using one instead of the other in C++? ...

What are the most used parts of STL?

What parts of STL (no boost or TR1, please) people still commonly use in their professional as well as personal environments, if any? These days I find myself using the following: Containers: vector set map Iterators: const and not for above containers Functional objects: bind1st bind2nd Algorithms: find find_first_of f...

C++ STD::Vector using templated function taking abnormally long to run

The following function operates with two values for T. One is 4 bytes (same as a DWORD). The other is 64 bytes. The Buffer is designed to store objects in its cache, and have them retrieved at a later date. When using the 64 byte structure, the total amount of time in the function jumps dramatically. The seek time in the vector, the...