c++

How to change default output file of g++ in ubuntu ?

Trivially 'g++ sample.c' generates 'a,out' Can g++ be configured to output to a different default name for output file ? ...

Queue Simulation problem.

My program is to print the queue of information from a file but i have problem with my following code. When i run the program it keep loop. I cant figure out the problem. Any help? #include <iostream> #include <fstream> #include <string> #include <iomanip> #include <queue> #include <list> using namespace std; void simulation(ifstream &...

Compiling libraries with CMake under Cygwin

I have been trying to compile TinyXML using CMake as a sort of mini project, trying to learn CMake. As an addition I am trying to make it compile into a dynamic library and install itself so it works. So far I have managed to get it to compile and install BUT it compiles into a .dll and a .dll.a and the only way to get it to work is to ...

Signed right shift = strange result?

I was helping someone with their homework and ran into this strange issue. The problem is to write a function that reverses the order of bytes of a signed integer(That's how the function was specified anyway), and this is the solution I came up with: int reverse(int x) { int reversed = 0; reversed = (x & (0xFF << 24)) >> 24; ...

Name of locking design pattern (the one with `internal' methods)

I recall a design pattern for handling locking issues in C++ (where some locks are not re-entrant) by separating methods into 'external' and 'internal' ones. External ones acquire locks and can call internal ones which in turn assert that locks are held. External ones cannot call other external ones (because that would deadlock) and for ...

Memory access time slow with VirtualAllocExNuma on Windows 7/64

In our application we are running on a dual Xeon server with memory configured as 12gb local to each processor and a memory bus connecting the two Xeon's. For performance reasons, we want to control where we allocate a large (>6gb) block of memory. Below is simplified code - DWORD processorNumber = GetCurrentProcessorNumber(); UCHAR ...

why my template is already defined?

hey, i'm trying to compile my work and i'm getting this error : function template has already been defined and it's written about all my template functions. any idea what can cause such thing? ...

Is there any compiler simulator for mobile phones?

I was wondering if there exists an application for mobile phones(any platform) that simulates compiler, validates syntax? It would be nice to have one the phone:) Particularly I am looking something for C# or C++(like gcc). It does not have to generate any output code, just the front-end part(lexilal, syntax analysis...) ...

C++ Exception throw annotations on virtual functions

Hello all, I saw the following snippet code: class Foo { public: void virtual func() throw (int, float) = 0; }; class Bar : public Foo { public: void virtual func() throw(short); // line 1: compile error " // looser throw specifier" void...

Counting Null Values in an array

Making an uno game for a project. all 108 cards are located in a filled array named cardDeck[108] the start function pulls 7 cards at random and fills the players hand by adding them to an array called playerHand[] I need help on this please. 1) I don't know how to make the cards dissappear out of the cardDeck array when they are pu...

Calling unmanaged code from ASP.NET in IIS7

Hi, I call a DLL in ASP.NET a DLL that is written in C++. When running it into IIS 7, The pool (w3wp.exe) crash and the "just in time debugging window" open. I do many tracing and I found that crash happen when calling any function (in the unmanaged DLLs) that have a "out string" parameter (or return a string value). I saw on the web t...

C++x0 unique_ptr GCC 4.4.4

Hi, I am trying to make use of the unique_ptr from C++x0, by doing #include <memory> and comping with -std=c++0x, however it is throwing up many errors this being an example. /usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../include/c++/4.4.4/bits/unique_ptr.h:214: error: deleted function ‘std::unique_ptr<_Tp, _Tp_Deleter>::uni...

Learning C++ as a competent programmer

Possible Duplicate: What is the best approach for a Java developer to learn C++ I'm sure this is a duplicate question, but I can't find exactly what I'm looking for. I've been programming for several years, mostly in Java with some .NET experience, but now I'm starting a job using C++. I know just enough of it to be dangerous...

inline function in namespace generate duplicate symbols during link on gcc

I have a namespace with inline function that will be used if several source files. When trying to link my application, the inline function are reported as duplicate symbols. It seems as if my code would simply not inline the functions and I was wondering if this is the expected behavior and how to best deal with it. I use the following ...

Python or C++? Programming for mobile devices.

Hi, I am interested in programming for Mobile Devices. Now I have a phone which runs Symbian S60 3rd, which is one of my motivations for programming for mobile devices. Now, my question is, which one is better to go for? Python or C++? I have a good background in C++ (ANSI), Java and C#. Thanks. ...

What is the difference between same-named inherited function and overridden virtual function ?

#include <iostream> using namespace std; class base { public: void f() {cout << "base" << endl;} virtual void v() {cout << "base (virtual)" << endl;} }; class deriv : public base { public: void f() {cout << "deriv" << endl;} void v() {cout << "deriv (overridden)" << endl;} }; int main() ...

A cast that is breaking strict-aliasing rules

I have a function that takes a unsigned long* and needs to pass it to a external library that takes a unsigned int* and on this platform unsigned int/long are the same size. void UpdateVar(unsigned long* var) { // this function will change the value at the address of var ExternalLibAtomicUpdateVar((unsigned int*)var); // lib atomi...

Slow face detection on OpenCV ?

Hi, I compiled and installed OpenCV (last version from the SVN) on Mac Os X (this is maybe the source of the problem). The sample works, but the face detection algorithm seems slow to me. The detection time for a face is around 400ms (I just used the example included). The FPS is then quite low. On youtube and all, I see super-smooth ...

What is an in-place constructor in C++?

Possible Duplicate: C++'s placement new What is an in-place constructor in C++? e.g. Datatype *x = new(y) Datatype(); ...

Mixing C++ and Objective-C (Suspected Automake problem)

So, I've been working for some time on connecting hashing out a trivial application, comprising C++ and Objective-C, to prove some concepts and try and learn something. Here's where I'm at now, my command (being run, and re-run on changes) is $ autoreconf -vis && make clean && ./configure && make && ./src/greetings Note, that I'm h...