Questions for c++


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

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.


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

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

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

Vector of Vector Initialization

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

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.

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

gdb control jumping to random position

Here is the code snippet which I want to debug:

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

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?

why its jumping out of program?

I just start learning C++.

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

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

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

How to design a latest recently used cache?

How to design a latest recently used cache?

Firefox plugin crashes in Chrome

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

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.

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.

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

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

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

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:

Forward declare an STL container?

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

Well-known solution for avoiding the slowness of dynamic_cast?

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

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

string iterators are incompatible

Here is my sample code ..

C++ character array allocation error

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

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.

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

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.

Extending a program to count line frequency

I have this simple program to count the word frequency:

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:

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.

Recursive function behavior in c++

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

Erasing a Char

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

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:

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:

SEGV in gcc's std::unordered_map

I have encountered a SEGV in gcc 4.7.2's unordered_map

generating *char buffer

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

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.

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:

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,