c++

Good Book/Training material to learn multithreading in C/C++

Hi, I am just a starter at using threads in my code. I use Boost threads usually. But I don't think I have mastered this field yet. I am looking for learning material specifically for advanced parallel programming. Could anybody suggest something. ...

C++ preprocessor

I'd rewritten a simple C++ program using unix as a variable name. But the program compilation failed. #include <iostream> int main() { int unix = 1; return 0; } After searching a lot on the internet I got to this website which helped me by saying that unix is predefined macro equal to 1. I want to know list of all suc...

QT Creator not allowing me to save anything

I'm new to QT and the IDE is driving me insane. I've hit this problem now and It won't go away. If I load up QT Develop and edit a file, it stars it to let me know it needs saving. If I then try to save it it warns me that the file is read only, offering me the option of "Make Writeable" why it thinks it is read only I have no idea. ...

Smart answer needed for strange segmentation fault on embedded ARM with posix threads

Hi, The last couple of days I've been working on a strange segmentation fault. The following code works just fine on my PC running Linux. But using the ARM crosscompiler suppplied by the manufactor of our embedded device, it gives a segmentation fault in routine s(). The SIGSEGV occurs at the destruction of a std::string. This also happ...

Register Game Object Components in Game Subsystems? (Component-based Game Object design)

I'm creating a component-based game object system. Some tips: GameObject is simply a list of Components. There are GameSubsystems. For example, rendering, physics etc. Each GameSubsystem contains pointers to some of Components. GameSubsystem is a very powerful and flexible abstraction: it represents any slice (or aspect) of the game wo...

Constants and Classes Declarations Across Multiple Source Files in C++

I am sure this problem is asked a lot but I can't seem to find anything relevant. I have multiple source files in a C++ project. In typical fashion, there are multiple header files with class and function declarations and associated source files with their definitions. The problem is that when I try to use one of my classes defined in an...

C++ TCHAR[] to string

Hello everyone I have this method which receives a path through a TCHAR szFileName[] variable, which contains something like C:\app\...\Failed\ I'd like to sort through it so I can verify if the name of the last folder on that path is in fact, "Failed" I thought that using something like this would work: std::wstring Path = szFileNam...

C\C++ LINPACK source code for window free for commercial use?

Hello! I need run benchmark to test my cpu FLOPS and compare this with raitings such as top500 org. I known Linpack is are standart for measure CPU perfomance. But i can find source code for windows on C\C++ without not free librarys like Intel MKL library, etc Maybe someone know where i can find C\C++ LINPACK source code for window free...

different rand() results on Windows and Linux

Hello ! I've noticed, that standard rand() function gives different results on Windows and Linux. Ofcourse I've used the same seed number (1234). Here are several first results: WIN: 4068 213 12761 8758 LIN: 479142414 465566339 961126155 1057886067 My application requires that both platforms produce identical output. What are my optio...

C++/Eclipse CDT code completion problem (Wascana,mingw)

Hi, I've a problem with my CDT. Code completion doesn't work for standard library classes. For example in this code after entering x. and presing ctrl+space IDE doesn't display the list of API elements. #include void f() { string x = "sss"; x. } String and vector header files are available in Includes directories. When I press ...

unexplained syntax error defining threadpool inside class definition

I have the following class definition and for some reason I cannot define the threadpool inside the class definition itself. It says: syntax error: identifier 'numberofpoolthreads' I tried directly defining it in the class, but it gives me same syntax error, does anyone know why this is? #include "stdafx.h" #include <boost/threadpool....

Is i = 0, ++i defined ?

I recently learned about the , operator and the fact that it introduces a sequence point. I also learned that the following code led to undefined behavior: i = ++i; Because i was modified twice between two sequence points. But what about the following codes ? i = 0, ++i; i = (0, ++i); While I know the rules, I can't get to a conc...

How to specify include directory for configure script.

I have a linux system at my workplace with pretty old packages and no root access. I'm compiling packages that I need from source with --prefix=[somewhere in homedir]. My problem is that I just can't find out how to convince configure to look for header files in a specific directory. The source is cpp. I tried with environment variables ...

Is it better to have lot of interfaces or just one?

I have been working on this plugin system. I thought I passed design and started implementing. Now I wonder if I should revisit my design. my problem is the following: Currently in my design I have: An interface class FileNameLoader for loading the names of all the shared libraries my application needs to load. i.e. Load all files in ...

'stdx’ is not a namespace-name error being shown for a ptr_vector program

I've been trying a program from codeproject, about ptr_vector, and while compiling, the above error is shown. Googling shows no hope to solve this problem. Could anyone here help out? Here's the entire code (am compiling with gcc 4.2.2) #include <iostream> #include <string> #include <boost/ptr_container/ptr_vector.hpp> using namespace ...

C#, C++ project mix: Could not load file or assembly

I have Visual Studio 2010 solution of 2 projects: c# and c++ c++ project using .net framework libraries and exposes class that is referenced from c# project. Everything compiles fine and c# project intellisence helps me with methods exposed from c++. But when I try to launch c# project it crashes with exception: Could not load file ...

Should I use Boost.GIL or is it dead?

I actually like the clean approach of Boost.GIL, standardized libraries are cool and Adobe certainly put some thought in it but when comparing to libs such as OpenCV its feature set is marginal. Do you use GIL and for what purposes? ...

Array wraparound with modulo of unsigned

I'm trying to implement a lagged Fibonacci pseudo-random number generator for integers up to some maximum. It maintains an array of values int values[SIZE] = { /* 55 seed values */ }; and uses the following function to return the next value unsigned lagfib() { static unsigned idx = 0; int r = values[idx]; /* The followin...

what is the best c++ wrapper to webkit ? for staticlly linking (not QWebkit)

i need to statically embed web browser in c++ , webkit is good idea , is there any easy c++ wrapper around this kit , i know the Qt version but i can only dynamically link it and its no good for me. ...

-D option is expanded incorrectly from g++ command line

In C++ CodeBlocks project I added the following definitions to the project settings, compiler settings, #define: _DEBUG DATA_DIR=\"/media/Shared/SiX/Data\" This produces the following g++ command line: g++ -Wall -g -fPIC -save-temps -D_DEBUG -DDATA_DIR=\"/media/Shared/SiX/Data\" -I../Includes -c /media/Shared/SiX/SiXConfigurat...