c++

Have you ever crashed a debugger?

The title says it all. Recently I was debugging a project and the debugger (GDB 7.1) crashed all of a sudden, because of an endless recursion while trying to print a graph structure. At first I couldn't even imagine that a debugger could crash (a stable version) but it had. So it's really interesting to me, have you ever crashed a debugg...

Viewing data in memory window

why can't I see the variable 'x' in memory window of VS2005 while stepping the code using debugger? int main() { char *c = "String"; //visible char x = 'a'; // not visible } ...

Why does ICU's Locale::getDefault() return "root"?

Using the ICU library with C++ I'm doing: char const *lang = Locale::getDefault().getLanguage(); If I write a small test program and run it on my Mac system, I get en for lang. However, inside a larger group project I'm working on, I get root. Anybody have any idea why? I did find this: http://userguide.icu-project.org/locale/resou...

error when compiling c++ code with g++

i get error of this type: "in function ... multiple definition of ..." "... first defined here" "warning: size of symbol ... changed from to in " *the code is compiled with the flags: -ansi -Wall -pedantic-errors -Werror *STL is used is there any explanation for that? thank you in advance ...

is std::vector same as array[number]?

Possible Duplicate: Are std::vector elements guaranteed to be contiguous? does std::vector always contain the data in sequential memory addresses as array[number]? ...

How do I open a Open File dialog in OS X using C++?

I'm working on an application using OpenGL and C++ that parses some structured input from a file and displays it graphically. I'd like to start an Open File dialog when the application loads to allow the user to choose the file they want to have displayed. I haven't been able to find what I need on the web. Is there a way to achieve this...

Any way to determine if class implements operator()

I'm trying to find is there's a way to check if a class is a functional because i want to write a template which uses it? Is there an easy way to do this? Or do I just wrap things in a try/catch? Or perhaps the compiler won't even let me do it? ...

Implementing custom STL-like data structures

I have already implemented and tested the data structure and would now like to make it compatible with the collection of STL algorithms. Guidelines for implementing a custom iterator and the like. Specifically: What is the minimum set of operations that must be supported? (e.g. ++, +=, ==, !=?) Are there any properties of these operati...

Why doesn't this C++ code work?

int Socket::Connect(const std::string& host, int port) { if(this->_connected) throw "Socket is already connected"; // Get the IP from the string hostent* ip = gethostbyname(host.c_str()); /*if(server == NULL) throw strerror(WSAGetLastError());*/ // Information for WinSock. sockaddr_in addr; ...

Accessing Windows Native API from User-Mode

I'm quite curious about the Windows Native API. I have been searching around the net and have failed to find an example of calling a Native API function from user-mode. I believe I have a basic grasp of what this entails - specifically, I have to define constants and the native API function in my program, and use GetProcAddress to find t...

Trying to use STL without smart pointers - trying to avoid temporary object creation

I particularly like the simplicity of using STL containers in the straightforward way. I have never really figured out how to get the Boost library working on my dev platforms, in fact I don't think I've even tried. I guess you could say I am just trying to delay the inevitable since Boost is clearly a helpful library that I should be ...

How to iterate through a sequence of bounded types with Boost.Variant

struct A { std::string get_string(); }; struct B { int value; }; typedef boost::variant<A,B> var_types; std::vector<var_types> v; A a; B b; v.push_back(a); v.push_back(b); How can I iterate iterate through the elements of v to get access to the a and b objects ? I'm able to do it with boost::get b...

How to share COM objects between 2 processes?

I want Application1.exe to instantiate an instance of its Item class. I want Application2.exe to call GetPrice() on this object. I have followed steps 1-7 on the following website: http://www.codeguru.com/Cpp/COM-Tech/activex/tutorials/article.php/c5567/ This is what I have so far. Application1's main looks like this: CoInitialize( N...

Controlling output of program

I'm writing a code to output fibonacci series in C++, which is simple enough, but since I'm new to programming, I'm considering ways to control I was wondering if there's a way to control time for when outputs come out without processing time being included (e.g. If it takes .0005 seconds to process my input and I want it to repeat the ...

problem with clang application

Hi, I am building an application using clang libraries, I running to a problem, it will be very helpful if somebody can give some directions. #./a.out /home/nmathew/Desktop/algorithms/array.cpp gives In file included from /home/nmathew/Desktop/algorithms/array.cpp:1: In file included from /usr/include/c++/4.4.3/iostream:39: In file i...

Parsing a grammar with Boost Spirit

I am trying to parse a C-function like tree expressions like the following (using the Spirit Parser Framework): F( A() , B( GREAT( SOME , NOT ) ) , C( YES ) ) For this I am trying to use the three rules on the following grammar: template< typename Iterator , typename ExpressionAST > struct InputGrammar : qi::grammar<Iterator, Express...

How to know whether I have admin authority in windows?

Is there any APIs in windows to detect whether the current user(current now) has the admin authority? BOOL IsHasAuthority() { } Many Thanks! ...

What can glStencil do?

I'm wondering what the stencil buffer is and what it can do. Thanks ...

Defining volatile class object

Can the volatile be used for class objects? Like: volatile Myclass className; The problem is that it doesn't compile, everywhere when some method is invoked, the error says: error C2662: 'function' : cannot convert 'this' pointer from 'volatile MyClass' to 'MyCLass &' What is the problem here and how to solve it? EDIT: class Queue ...

Access objective-c from c++

Can somebody point me in the right direction for this. I've found lots of info on using c++ in obj c but not the other way around. I am making an iPhone game in c++ but need to tap into some of the features the iPhone has to offer. Thanks ...