c++

How masking works.

Hello, I am new at C, and I am debugging with source code. However, I am confused with this code snippet. When the values are assigned to the structure value, I think it is some masking. But not sure, and if it is masking. How does masking work in this concept? Many thanks, #define MSGINFO_ENABLE 0x01 #define MIME_E...

Compiling PARDISO linear solver test case with GCC

I am trying to compile a linear system solver using PARDISO. The test case (pardiso_sym.c) also downloaded from the same website above. I have the following files inside the directory: [gv@emerald my-pardiso]$ ls -lh total 1.3M -rw-r--r-- 1 gv hgc0746 1.3M Aug 7 11:59 libpardiso_GNU_IA64.so -rw-r--r-- 1 gv hgc0746 7.2K Nov 13 2007 p...

Can a C++ Static Library link to shared library?

Say I have a static C++ lib, static.lib and I want to call some functions from a C++ shared lib, say shared.lib. Is it possible? Now assume that I have another shared lib, say shared2.lib which links to static.lib but does not link to shared.lib. Does the linker automatically link shared2.lib to shared.lib in this case? I am using Micr...

Constructor initialization-list evaluation order

I have a constructor that takes some arguments. I had assumed that they were constructed in the order listed, but in one case it appears they were being constructed in reverse resulting in an abort. When I reversed the arguments the program stopped aborting. This is an example of the syntax I'm using. The thing is, a_ needs to be init...

I am getting a Strange errors error LNK2001: unresolved external symbol _deflateEnd in VC++ please help

I am using a external library of libharu-2.0.8, this is a open source pdf library. This lib have a lib file called libhpdf.lib and few header files I have written a simple code to use this library. I am getting following errors. libhpdf.lib(hpdf_streams.obj) : error LNK2001: unresolved external symbol _deflateEnd libhpdf.lib(hpdf_st...

Quickest way to find substrings in text files

What's the fastest way to find strings in text files ? Case scenario : Looking for a particular path in a text file with around 50000 file paths listed (each path has it's own line). ...

Given an Array, is there an algorithm that can allocate memory out of it?

Hi, I'm doing some graphics programming and I'm using Vertex pools. I'd like to be able to allocate a range out of the pool and use this for drawing. Whats different from the solution I need than from a C allocator is that I never call malloc. Instead I preallocate the array and then need an object that wraps that up and keeps track of ...

Disjoint set as linked list

Can anyone point me to some info on Disjoint sets as linked list? I cant find any code on this. Language C++ ...

Convert string to int with bool/fail in C++

I have a std::string which could be a string or could be a value (such as 0) Whats the best or easiest way to convert the string to int with the ability to fail? i want a c++ version of C#'s Int32.TryParse ...

C++ Operator overloading - casting from class

While porting Windows code to Linux, I encountered the following error message with GCC 4.2.3. (Yes, I'm aware that it's a slight old version, but I can't easily upgrade.) main.cpp:16: error: call of overloaded ‘list(MyClass&)’ is ambiguous /usr/include/c++/4.2/bits/stl_list.h:495: note: candidates are: std::list<_Tp, _Alloc>::list(cons...

C++ delete from vector in for loop crash

Hi, I'm having a problem with my looping over a vector, and deleting values from another vector sometimes crashes my program. I have this vector of int's to keep track of which elements should be removed. std::vector<int> trEn; Then I loop through this vector: struct enemyStruct { float x, y, health, mhealth, speed, turnspeed; ...

Replacing Value of Diagonals in (m x m) Matrix With its Column Sum with Memory Efficient Way in C++

I have the following matrix of size m=4 0.00000 0.09130 0.09130 0.00000 0.04565 0.00000 0.00000 0.00000 0.04565 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 And I want to replace the diagonal of that matrix with (1 - sum of its column). Resulting matrix: 0.90870 0.09130 0.09130 ...

C++ FTP Library?

Hello there, I am looking for an FTP Library for C++ to do basic ftp functions like authenticate, change directory, upload files, etc. but I can't seem to find one. I've searched over Google, Sourceforge, and CodeProject (well, there's one complete FTP CLIENT project for Win95 in CodeProject, however I don't need the entire ftp client.....

Problem with select() call

I created two sockets udp_S, tcp_S (one each for UDP AND TCP).Now I want to wait on select() call until there is any data sent from any UDP client or there is any request for coonection by a TCP client. Here is a brief snippet of my code: int udp_S,tcp_S; /*Create sockets using socket()*/ /*Bind address to them using bind()*/ fd_set ...

TrayIcon balloon does not show up

Hello, I compiled my trayicon utility c++ code in visual studio 2005 express edition and tray icon balloons showed up successfully but later I deleted my firewall, switched on to windows firewall and now I am on another firewall software. Now i ran my same project and balloons showed up successfully but when i rebuilt it, i can't see bal...

Placement of a method in a Class

I have a C++ class in which many of its the member functions have a common set of operations. Putting these common operations in a separate function is important for avoiding redundancy, but where should i place this function ideally? Making it a member function of the class is not a good idea since it makes no sense being a member func...

order of functions in cpp file

is there a standard in order of functions in cpp file? there are: global functions constructors destructors getters setters algoritmic functions if qt, slots if a derived class, overrided functions static functions any function type that i can not name... in cpp file, is there any good way to order? i order them as i wrote in t...

AccessViolation when using C++ DLL from Delphi

I have a weird problem trying to use a DLL written in C++ from a Delphi (Turbo Delphi 2006) program. When I run the Delphi program (see below) from the command line, everything works fine. Also, when I run it from the Delphi environment without debugging (CTRL+SHIFT+F9), everything is fine. However, when running it with debugging (F9), ...

TBuf to TInt Symbian

Hi I simply wanna convert a TBuf to TInt in Symbian. I tried to do it the following way: TBuf<2> buf; buf.Copy( _L("10")); TInt valInt; TLex8 lex(buf); lex.Val(valInt); Here I get then the error message: Error: #289: no instance of constructor "TPtrC8::TPtrC8" matches the argument list argument types are: (TBuf<2>) Help ...

QPixmap of a QGraphicsTextItem

How do you convert/paint a QGraphicsTextItem into a QPixmap? ...