Questions for c++


2844
5757

A short c++ file and makefile: I can make in the shell, but get lots of error while building it in the Eclipse

I'm compiling a very short c++ file using makefile.The c++ file using a external libary named ClanLib, but that's not the point, because I can use "make" command to compile it in the shell, so the...
270

C++ extern function error: too many arguments to function

I have a cw.h file with a bunch of extern functions in it that I want to call from my cw.cpp file.
4543

IF ELSE CONDITION

I am working on the visual studio c++ and using these lines in my program.
5854

Recursive left-recursion in hand-written recursive ascent parser

I've been writing some recursive ascent parsers, and one of the things I've been struggling with is left recursion. It seems obvious to me that right recursion can be expressed recursively, like
4938

Correct behaviour for std::vector<T>::value_type

After scratching my head at some errors in some template code that used std::vector::value_type I tracked it down to the following. Is this correct behavior according to the standard, or is this a
7527

Vector of Vector Initialization

I am having a tough time getting my head wrapped around how to initialize a vector of vectors.
4433

How to add a question mark to the end of a line?

I want to check to see if the user added a ? to the end of the buffer. If not, I want the program to add one automatically. This is what I have so far. I dont know what to do next.
3705

Velocity and Time Elapsed in sfml 2.0

So I have been looking for hours now and I can't seem to find anything to help me with this, so I'll start by saying I am new, like very new, but I do understand that in order to have constant move...
7002

gdb control jumping to random position

Here is the code snippet which I want to debug:
3371

Cascading overloaded cout operator error `No match` when used with other overloaded operators

I have overloaded &lt;&lt; in my code as a friend function. Even after using braces while cascading there is still the error
1024

When assigning in C++, does the object we assigned over get destructed?

Does the following code fragment leak? If not, where do the two objects which are constructed in foobar() get destructed?
7785

why its jumping out of program?

I just start learning C++.
8691

C++: Infinite loop with a simple menu selection

The script I am working on is over a page long, so I am going to link it (one simple file):
4259

The simpliest way to visualize - easy-use graphics. Which languages and lib?

I'm going to develop math model of trafics simulation and will need to somehow vizualise it. The model will be in C++
8632

Free Allocated Memory Generates Exception - C++

There is a function in my application in which memory is allocated for formatting a port name. CreateFile is called to open the port. At the end of the function free is called to attempt to free ...
7229

How to design a latest recently used cache?

How to design a latest recently used cache?
1511

Firefox plugin crashes in Chrome

From what I gather, Google Chrome can run browser plugins written using NPAPI.
5271

Ant -> Nant -> Visual Studio 2005 Build

I am working on a big C++ project. It is building using single Ant script which makes possible to compile the same source targeting more than one platform and compiler.
866

How do I zip a directory or multple files with zlib, using C/C++?

I did search for this topic, but I didn't find any relevant clue for this.
5487

Can anyone quantify performance differences between C++ and Java?

Java was initially slow before the JIT but today performance is pretty close to C++. I want to know if someone has done measurable performance comparisons between the two languages? Where does Java
1112

Commonly Accepted Variable Name Formatting - C/C++

I realize that this can be a matter of preference, but I have noticed that variables names in a lot of code samples I've seen have a prefix of g_, s_, m_, or just _. Is this a commonly accepted
773

How do I tell valgrind to memcheck forked processes?

I have a process x that I want to check for leaks with valgrind. The problem is that x is run by y, and y in turn is run by z. I can't run x standalone because y and z setup the environment for x...
7775

Why is this call to overloaded function ambiguous?

I am a beginner in template programming and I am using the following template function trying to avoid code duplication:
9129

Forward declare an STL container?

Is it possible to forward declare an STL container in a header file? For example, take the following code:
1194

Well-known solution for avoiding the slowness of dynamic_cast?

I needed run-time polymorphism, so I used dynamic_cast.
8996

C++/Qt vs Adobe AIR

I have to choose a platform for our product. I have to decide between The Qt Framework and Adobe's AIR. I am well versed with Qt as I have worked for the last two years. I looked up at the Adobe's ...
9386

string iterators are incompatible

Here is my sample code ..
2648

C++ character array allocation error

I have a function designed to get a file's contents:
1457

readability of long int v. long

Which is more clear to someone reading code? "long" or "long int". "long int" is more descriptive, but "long" is more succinct.
8670

Extract common class behaviour in a template

I observed that in my program I needed to make several classes use the following common pattern. The idea behind it is that resource_mgr maintains a list of reference-counted pointers to resource
4135

Custom comparator (ordering) as a (multi)map ordering parameter?

My question is in many ways similar to this one: Pass a custom comparator through a function, but I tried the solution proposed there, and could not get it to work.
2647

Extending a program to count line frequency

I have this simple program to count the word frequency:
4705

DirectX - Error when pressing ctrl + alt + del

So far my program is working pretty well. Unfortunately when I press ctrl + alt + del it throws an error. Now I have read this question:
9361

C++ - removal of a node in an AVL Tree

I'm currently trying to implement an AVL tree in C++, so far I've done pretty much everything except a node removal.
4346

Recursive function behavior in c++

I know basic definition of recursive function.....but i want to know its impact on memory??
2523

Erasing a Char

Okay i am working on someone elses code. They do alot of this:
9337

What is the Windows equivalent for en_US.UTF-8 locale?

If I want to make the following work on Windows, what is the correct locale and how do I detect that it is actually present:
6907

Cross-platform (linux/Win32) nonblocking C++ IO on stdin/stdout/stderr

I'm trying to find the best solution for nonblocking IO via stdin/stdout with the following characteristics:
1855

SEGV in gcc's std::unordered_map

I have encountered a SEGV in gcc 4.7.2's unordered_map
5537

generating *char buffer

I need to create a buffer that contains 300 symbols and pass it to the function described below:
6984

closed source library includes boost distribution

I'm using a closed source library (by Activ financial) that includes with their API a boost distribution, both some boost header files and boost library files.
6908

unresolved names linking against library but passing obj files directly works fine?

Consider the following g++ invocation (Apple GCC 4.2.1, running on OSX 10.6.5) which works just fine:
7844

inet_aton() returning success for invalid ip addresses?

I am looking for some function to verify that if given string is a valid ipv4 address,