c++

What are the most useful high quality free C++ projects you really learned a lot from?

In your opinion what are the best C++ projects you have really learned a lot from learning their code? The design should be very clean and easy to follow, although it can be very advanced and huge, to show how good designs can abstract complexity. And of course the code should be available for free. ...

Question about precompiled headers in Visual C++

If I put a header (a.h) into stdafx.h and that header includes another header (b.h) that is not mentioned in stdafx.h, will b.h be visited every time someone includes a.h or is it compiled in as part of a.h? If it is compiled into a.h, what happens when someone includes b.h directly? Will this be precompiled or not? My motivation for ...

what does this code mean?

this is some code that SDL requires in visual studios 2005 in order for my simple program to work. what is the code doing? the only reason i have it is because my instructor told me to put it in and never explained it. // what is this code doing? //--------------------------------------------------------- #ifdef WIN32 #pragma comment(li...

using pointers to get values back from a function (c++)

i have a function to calculate several different values: int ASPfile::get_dimensions(int* Lat, int* Lon, vector<double>* Latgrid, vector<double>* Longrid) { _latsize = get_latsize(); _lonsize = get_lonsize(); Lat = &_latsize; Lon = &_lonsize; latgrid = read_latgrid(); longrid = read_longrid(); *Latg...

Can an STL map iterator go out of bounds through incrementing?

For associative containers, can the ++ operator send an iterator past the end of a collection? Example: map<UINT32, UINT32> new_map; new_map[0] = 0; new_map[1] = 1; map<UINT32, UINT32> new_iter = new_map.begin(); ++new_iter; ++new_iter; ++new_iter; ++new_iter; ++new_iter; ++new_iter; ++new_iter; At the end of this, does new_iter ==...

Boost Multi-Index Custom Composite Key Comparer

I'm looking to write a custom comparer for a boost ordered_non_unique index with a composite key. I'm not exactly sure how to do this. Boost has a composite_key_comparer, but that won't work for me, because one of the comparers for a member of the key depends on a previous member. This is a simplified example, but I want the index to ...

What language is .NET Framework written in?

The question I always wanted to ask and was afraid to, actually - what language is .NET Framework written in? I mean library itself. It seems to me that it was C and C++ mostly. (I hope Jon Skeet is reading this one, it`ll be very interesting to hear what he thinks about it) ...

C++ and pulseaudio "not declared in this scope"

Hi folks! I'm trying to use pulseaudio to play the contetst of a vorbis-stream but are hitting problems. Basicly I'm told that: ‘pa_simple’ was not declared in this scope ‘pa_simple_new’ was not declared in this scope ‘pa_simple_write’ was not declared in this scope Some code are shown below: #include <pulse/pulseaudio.h> pa_sim...

How to create a new port and assign it to a printer

We have a virtual printer (provided by a 3rd party) that is getting assigned to an invalid local printer port. The printer is always local (we aren't dealing with a remote print server or anything like that). I'd like to create a new local port (specific for our application), then configure the printer to be assigned to that port inste...

can't step into c++ program pixel city in netbeans on ubuntu

I'm using NetBeans 6.7 on Ubuntu, and I downloaded a linux port of shamus young's pixel city, http://github.com/BryanKadzban/pixelcity/tree/master but I can't step into it (it compiles and builds and runs fine (a little slow but fine)). I can step into a c++ sample project in netbeans which seems to mean that gdb is working properly. ...

Convert HTML in CWebBrowser2 element into VECTOR metafile

I have tested a number of solutions to capture the HTML content of a CWebBrowser2 element into a vector metafile. I can get either part of the web page as vector emf, or I can get all of the webpage as a raster bitblt wrapped in an emf wrapper. What I want is All of the webpage as vector with only original bitmaps, flash, etc represent...

link with DB2 ODBC drivers on Linux

Hi All, I need to link our C/C++ code that is using the DB2 ODBC driver on linux, and although ive pulled in sqlcli.h I dont know where to find the objects so i can link. Ive installed DB2 v9.1 ESE so i wouldve thought i could get everything. Anybody got any ideas? ...

c++ public function syntax error

I am attempting to convert a c# to c++ with reflector. The code compiled, disassembled and reconstructed code is generating this error: 1>c:\users\user\documents\visual studio 2008\projects\reflect_readoo\reflect_readoo\readoo.cpp(2) : error C2059: syntax error : 'public' 1>c:\users\user\documents\visual studio 2008\pr...

accessing static member variables

Can I access static member variables of a class using dot notation or should I stick in access operator which is double colon? ...

How to read embed thumbnail from jpeg images?

I am writing a thumbnail viewer in c++. I first make use of EXIF information to retrive an image's thumbnail, but the thumbnail in the EXIF is bad, with black bands. So I want to get the jpeg's embedded thumbnail, how can I do this? Another question: does jpeg's embeded thumbnail equal to EXIF thumbnial? ...

Weird behavior of template arguments in Visual C++ ?

I tried this example from "C++ Template - The Complete Guide" by Nicolai M. Josuttis #include <iostream> using namespace std; template< typename T > class List { }; typedef enum { RED, GREEN, BLUE } *color_ptr; int main() { struct Local { int x; }; List< Local > l; // error : local type in template argument ...

What are your favorite debugging techniques in C++?

There are printfs, asserts, edit and continue, logging frameworks? Whats your favorite poison? ...

sum of square of each elements in the vector using for_each

Hi, As the function accepted by for_each take only one parameter (the element of the vector), I have to define a static int sum = 0 somewhere so that It can be accessed after calling the for_each . I think this is awkward. Any better way to do this (still use for_each) ? #include <algorithm> #include <vector> #include <iostream> us...

How to tell a column is text or ntext when connecting to database using CDynamicAccessor?

I'm having a C++ application connecting to the MS SQL Server 2005 using CDynamicAccessor. When my column is text or ntext, the CDynamicAccessor::GetColumnType always return DBTYPE_IUNKNOWN. I can bind the data as ISequentialStream and read the byte stream out. However, how can I tell if the column that I'm reading is text or ntext, and h...

Best Tools for helping debug an Interop issues

Hi guys, One of our customers is getting an interop issue, there is nothing in the stack trace that is worth noting, just ComException with an InterOp issue. I've tried Process Monitor and Dependency Walker, but nothing seems to pop up. It is C++ Managed running on .net 1.1. Any helps with any tools would be a life saver!? ...