Questions for c++


2862
4590

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...
1017

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.
1391

IF ELSE CONDITION

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

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
1119

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
2971

Vector of Vector Initialization

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

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.
1387

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...
5145

gdb control jumping to random position

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

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
931

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?
6474

why its jumping out of program?

I just start learning C++.
9483

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):
2640

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++
980

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 ...
3307

How to design a latest recently used cache?

How to design a latest recently used cache?
8950

Firefox plugin crashes in Chrome

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

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.
9645

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.
6385

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
399

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
1851

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...
1598

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:
2611

Forward declare an STL container?

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

Well-known solution for avoiding the slowness of dynamic_cast?

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

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 ...
2216

string iterators are incompatible

Here is my sample code ..
7281

C++ character array allocation error

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

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.
7361

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
3551

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.
9108

Extending a program to count line frequency

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

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:
2766

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.
2767

Recursive function behavior in c++

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

Erasing a Char

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

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:
5569

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:
7683

SEGV in gcc's std::unordered_map

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

generating *char buffer

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

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.
1453

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:
5436

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,