c++

How to optionally depend on a shared object with gcc?

First, I don't know if there is a solution to my problem at all. I have the following situation: I have developed a framework library that depends on several other libraries for specific hardware access, etc. Until now this framework library was only statically linked against. For the executable that uses the framework library only th...

Is an int the same as unsigned or signed?

Is an int the same type as unsigned or signed? ...

Date/Time parsing in C++

While doing the data/time parsing in c++ (converting a string in any format to a date), i found the following useful methods 1) strptime() - here the %d, %m etc can have either 1 or 2 characters. The function will take care of that. As a result of this it will enforce that we use a separator between two conversion specifiers. Ex: Its n...

Debugging a crash when a library is opened via dlopen on OSX

Hello there, I have a problem with a C++ application I've developed which uses dlopen to load user-developed libraries. The application has been used by a variety of people on a variety of linux distros and versions of OSX over the last couple of years and so I'm assuming my usage of dlopen is OK and so is the code that depends on it (y...

C++ Reads/Writes XML without CLR

I know this is a very stupid question and I'm very new to C++. I'm developing Starcraft AI, it is DLL file. I'm trying to use XML to gather some data to the bot, however whenever I build the DLL with /clr option. The bot doesn't load properly. So, my question is what is CLR and is there a way to read/write XML without using /clr build ...

C++ boost forward declaration question

Hello! I spend some time examining boost:: libraries architecture and was interested with the following fact: In some parts of the libraries a yyy_fwd.hpp idea is used pretty common (see boost/detail or boost/flyweight for examples). These files obviously contain only forward declarations of some template-based classes and as far as I...

Where is the "virtual" keyword necessary in a complex multiple inheritance hierarchy?

I understand the basics of C++ virtual inheritance. However, I'm confused about where exactly I need to use the virtual keyword with a complex class hierarchy. For example, suppose I have the following classes: A / \ B C / \ / \ D E F \ / \ / G H \...

How to stop a process using a "Stop Button"

Hi, I created a simple window with two buttons, the first one calls a function that lasts a long time, the second one sets the value of a variable "stop" to TRUE, that was initially set to FALSE. My intention is that, by pressing the first button it runs a long process, that controls if the stop variable is set to TRUE or FALSE for ever...

GCC std::thread problem

I am using GCC 4.5.0 with the Eclipse IDE (if that matters) on Windows via MinGW. I'm using the -std=c++0x flag. I find that _GLIBCXX_HAS_GTHREADS still isn't defined, so thread for me still isn't a member of namespace std. -- or perhaps it is something else. What does one do to get C++0x threading support with GCC? P.S. It doesn't r...

How to debug program with signal handler for SIGSEGV

I am writing a plugin for a application, occasionally a SIGSEGV would be throw out. However, the application catches the signal SIGSEGV. In other word, The plugin is a dynamical library. The error occurs in my plugin and dynamical library. But the applcation handle the sSIGSEGV and exit normally. So, it is quite difficult for me to debug...

When and why is longjmp used in C++?

I have read the following tutorial, but I don't understand it well. When is longjmp used and why it is necessary to know? http://www.cplusplus.com/reference/clibrary/csetjmp/longjmp/ ...

Extract useful file list (with path) from Visual Studio C++ project

I am working with a team on quite a few visual studio (2008) projects which share a lot of code. Some files are used by all projects, but some are only useful to 1 or 2. I am looking for a way to extract all useful files for one particular project. The principle we use is to share directories. Each project selects the shared directorie...

How to cope with "the application has failed to start because its side-by-side configuration is incorrect" error in vmware?

Hi all, When I try to open released .exe file (which I wrote in Visual Studio 2008) in VMWare Workstation 6.5 with Windows Server 2008 32bit OS, got "The application has failed to start because its side-by-side configuration is incorrect." error all time even if the code is; #include <stdio.h> int main () { printf ("HELLO\n"); r...

problem returning CArray

Hi, I am trying to return CArray from a function and trying to call the function from another class short ListMaker::RetArray(CString szName, CArray<CString, CString&> &szarr_Names) { szarr_Names.Add(szName); return 0; } //////////// main() { .. CArray<CString, CString&> myArray; ListMaker LM; short nCode = LM.Re...

How to speed-up loading of 15M integers from file stream?

Hello, I have an array of precomputed integers, it's fixed size of 15M values. I need to load these values at the program start. Currently it takes up to 2 mins to load, file size is ~130MB. Is it any way to speed-up loading. I'm free to change save process as well. std::array<int, 15000000> keys; std::string config = "config.dat"; /...

Xcode debugger static member variables

Hello, Do you know how may I see the value of a static member variable from a class in xcode? I can all the other variables except the static ones. Thank you! ...

Boost::Signals encapsulation over network

I am currently involved in the development of a software using distributed computing to detect different events. The current approach is : a dozen of threads are running simultaneously on different (physical) computers. Each event is assigned a number ; and every thread broadcasts its detected events to the other and filters the releva...

in X is it possible to detect when shift is pressed and released when it isn't modifying another key?

as in the title, it doesn't appear to generate an event unless another key/button is pressed at the same time. thanks, james ...

Statically linking new libc symbols to use with a lower libc version

I have an app that uses eventfd and timerfd kernel syscalls. For that use you need a modern kernel and a libc that supports them, at least 2.8. My current situation is, I have a system with the proper kernel but a 2.7.11 libc version which obviously does not support the required functions for the new syscalls. But, as those 2 interfaces...

802.3 header length always 256 when using raw sockets in Linux

I have the following code to open a raw socket and send over it. In the send function I have a trace statement showing me that the length of my packet is 21. However, when I view the packets on the receiving end using a packet sniffer, I see: The actual packet length is 60. The length (as given in the 802.3 header) is 256. Neither of...