c++

Linux IDE with proper support for STL debugging

I am looking for a Linux IDE with support for STL debugging. the problem is that with Eclipse CDT, if I inspect the vector after the push_back: int main() { vector<string> v; v.push_back("blah"); return 0; } I get something hostile like {<std::_Vector_base<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, st...

Functions accepting C/C++ array types

It seems like g++ ignores difference in array sizes when passing arrays as arguments. I.e., the following compiles with no warnings even with -Wall. void getarray(int a[500]) { a[0] = 1; } int main() { int aaa[100]; getarray(aaa); } Now, I understand the underlying model of passing a pointer and obviously I could just def...

Vector Iterators Casting

Hey, In C++, I have a vector of type: vector<BaseClass*> myVector; In which, I insert (push_back) pointers of derived classes into it. Now, I want to pop back its elements so I do this: vector<ADlgcDev*>::iterator iter; for (iter = myVector.rbegin(); iter != myVector.rend(); iter++) { // but before I pop it, I need to shutdown it ...

C++ Redefinition Header Files

How do I prevent from including header files twice? The problem is I'm including the in MyClass.h and then I'm including MyClass.h in many files, so it includes multiple times and redefinition error occurs. How to prevent? I'm using #pragma once instead of include guards, and I guess that's fine. MyClass.h: // MyClass.h #pragma once...

Algorithm to filter a set of all phrases containing in other phrase

Given a set of phrases, i would like to filter the set of all phrases that contain any of the other phrases. Contained here means that if a phrase contains all the words of another phrase it should be filtered out. Order of the words within the phrase does not matter. What i have so far is this: Sort the set by the number of words in ...

LibCurl Unicode data

Hello! I'm writing an application, and I'm currently using libcurl. The libcurl callback function works fine when I implement it for the Ansi charset, but I fail to get it working when working with Unicode characters. int CURLConnectorAnsi::BufferWriter(char* data, size_t size, size_t nmemb, std::string* buffer) { int ReadBytes = 0...

How can I build imagemagick without any asserts

Right now I'm using the following: export CFLAGS="-O2-isysroot/Developer/SDKs/MacOSX10.5.sdk -arch i386 -I/sw/include/" export LDFLAGS="-Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk,-L/sw/lib/" sudo ./configure --prefix=/sw --with-quantum-depth=16 --disable-dependency-tracking --with-x=no --without-perl --enable-static --disable-share...

Is C++ showing its age as programmers try to use it in ways it was never designed to be used?

Background Using boost and other similar libraries is the easiest way to find compiler shortcomings, but is there a stage at which things go too far? This mangled symbol: _ZTSN5boost6spirit2qi6detail13parser_binderINS1_11alternativeINS_6fusion4consINS1_8sequenceINS6_INS1_16lexeme_directiveINS7_INS6_INS1_6actionINS1_9referenceIKNS1_4ru...

"Shallow" display of STL containers in Visual Studio debug mode?

I hit a wall while debuging my C++ class. It's a graph of sorts, something like this: class Graph { class Node { std::map<int, Node>::iterator _neighbors[4]; }; std::map<int, Node> _map; }; Basically, each node keeps track of exactly 4 neighbors by storing iterators to them in the containing class' map. The proble...

to run application automatically after CAB file installation in windows desktop , VC++

Hello I am creating a cab file .After installing cab file its upload exe file to the destination path whatever i given . But is it possible for run that application automatically after CAB file installation . ...

system("c:\\sample\\startAll.bat") cannot run because of working directory?

Hi, I have an application and executables. I want my application to run my executables. The executable files are in a folder, lets say in "c:\sample". In this directory there is a batch file that calls my exe's. like: start a1.exe start a2.exe start a3.exe let's name it as startAll.bat and suppose every exe has a data like a1.dat a...

What are the known C/C++ optimizations for GCC

I am have a lot of code that I need to optimize and make it run faster. I used opreport to tell me where the code spends a lot of time. I use the following command to get the statistics opreport -g -l -d Suggestions to get better statistics are appreciated using different flags, perhaps find it per line number instead of function numb...

C++ redefinition due to including header files multiple times

As, the title says. I'm encountering redefinition errors due to including header files multiple times. I know its because of that, but I don't know how to resolve. Yes, I previously posted the same problem in SO an hour ahead. But I wasn't able to explain properly (I think so) and didn't get answers expected. Here is the link: C++ Redef...

Switching callstack for C++ functions

Hi, Here's my previous question about switching C callstacks. However, C++ uses a different calling convention (thiscall) and may require some different asm code. Can someone explain the differences and point to or supply some code snippets that switch C++ callstacks (preferably in GCC inline asm)? Thanks, James ...

How to Remove SIP button of windows mobile

How to remove the SIP button of Windows mobile? I need a solution for Windows Mobile V6. Please post some sample app, or link about how to remove the SIP button. I have tried out this technique.. SHFullScreen(this.Handle, SHFS_HIDESIPBUTTON); This is not working for me. If you know please post full code. ...

How to reduce memory consumption in MingW based GUI Application ?

I just noticed the memory usage of a simple win32 C based GUI application with single main window taking around 3 MB memory ( via Task Manager ) I used Dev-c++ and Mingw as compiler , and generated windows application via project wizard. why that so ? is there any way to reduce it ? ...

How can I convert VC++'s DATE Type To C#'s DateTime ?

I got a binary file, and one of record field stored some date infomation. The save program is written by VC++ and using the DATE type. How can read it into C#'s DateTime type ? ...

Differences in Microsofts C++ STL for Windows CE?

Hi, anyone know of a complete list of the differences in Microsofts implementation of STL for Windows CE, compared to the full STL for desktop? I am using WinCE 6.0, with VS 2005. I am a bit suprised that they seem to have removed so many things; for GCC it is almost the same. Thanks! ...

Unable to catch c++ exception using catch (...)

I have a third-party library that is sometimes throwing an exception. So I decided to wrap my code in a try/catch(...) so that I could log information about the exception occurring (no specific details, just that it happened.) But for some reason, the code still crashes. On client computers, it crashes hard and the code to log the e...

c++ how to create a directory from a path

hello, what is a convenient way to create a directory when a path like this is given: "\server\foo\bar\" note that the intermediate directories may not exist. CreateDirectory and mkdir only seem to create the last part of a directory and give an error otherwise. the platform is windows, MSVC compiler. thanks! ...