c++

what does union U look like in the memory?

enum Enums { k1, k2, k3, k4 }; union MYUnion { struct U{ char P; }u; struct U0 { char state; } u0; struct U1 { Enums e; char c; int v1; } u1; struct U2 { Enums e; char c; int v1; int v2; } u2; struct U3 { ...

what's wrong with my makefile?

I have this project that that I compile with the following command: g++ ALE.cpp -lncurses This gives me a.out file. I have the following Makefile but it seems to not be edited correctly. HEADERS = LinkedListNode.h LinkedList.h Classes.h GUI.h Functions.h default: ale ale.o: ALE.cpp $(HEADERS) g++ -c ALE.cpp -o ale.o -lncurses ...

How to test a byte against a hex value?

I want to test if the byte I read from a data file is 0xEE, what should I do? I tried if (aChar == 0xEE) but doesn't seems working. thanks for any help ...

Is this a fine std::auto_ptr<> use case?

Hello all, Please suppose I have a function that accepts a pointer as a parameter. This function can throw an exception, as it uses std::vector<>::push_back() to manage the lifecycle of this pointer. If I declare it like this: void manage(T *ptr); and call it like this: manage(new T()); if it throws an exception pushing the pointe...

Learning c++ from a C# background

I want to learn c++ as I will be working on image recognition, etc. I have a few years solid experience in C# and I have made stuff with C# so I'm not lacking experience. What is a good book which will help me make the transition (I will still be doing C# as it is my main skill)? Also, would you agree that to be good at C++, a lot of e...

Python importing & using cdll (with a linux .so file)

Hi all! After one of my last questions about python&c++ integration i was told to use dlls at windows. (Previous question) That worked ok doing: cl /LD A.cpp B.cpp C.pp in windows enviroment, after setting the include path for boost, cryptopp sources and cryptopp libraries. Now i'm tryting to do the same in linux, creating a .so fil...

Trying to visualize points on a graph: how can I make C++ output this?

I am trying to create a simple visualization of what my code does. I am making a Poisson-Disk-Distribution class to generate a set of random points in a bounded rectangular region. Basically, what it does is it randomly generates a specified number of points in the bounded region and makes sure that each point is at least a certain dista...

developing a windows service in C++ without Visual Studio template?

I have a version of Visual Studio 2005 that doesn't include a Windows Service project template. Can I just build a (C++) console application and install it as a service without doing anything special within the application code itself. ...

Pop3 help for a C++ implementation!

Alright, so this is absolutely killing me... If anyone could help me, I would be the happiest man on the face of the earth... So, I need to create a C++ email client for a project at school, and I've been using the POCO open source C++ library, and I've been fine for working with email servers that do not need SSL authentication, but an...

what's the differences between .dll , .lib, .h files ?

why in a project should include some *.lib, .h or some other files ? and what are these things used for ? ...

Global Shell Hook only registering local events

I am trying to use a global shell hook to listen for windows created and destroyed events, but it seems as though my program is only registering the destroyed event for the local thread. No creation events at all, and definitely not the global events that I think they should be. I have spent the last day scouring the googles as well as ...

Base Class Pointer to Hold Boost Enum

Currently, I am using a type-safe enum class from Boost Vault : http://stackoverflow.com/questions/217549/which-typesafe-enum-in-c-are-you-using I found it is difficult to have a parent class pointer to refer to all enum class, due to Boost::enum is a template class : boost::detail::enum_base<T> I am using void fun(const boost::any& a...

suggest some online compiler for c/c++

hello, I am developing a website for which I need an online c/C++ compiler for testing codes online. Is there any possible and feasible solution for this. i need this compiler so that students can test there code online. Thnx in avance ...

Parser for 32-bit and 64-bit Mach-O binary/executable formats in C++

I'm looking for a C++ library that can parse 32-bit and 64-bit Mach-O binary format. I don't need anything fancy, just a disassembly and splitting the file into its sections, so no decompilation, name demangling and so on. I know I can either rip open any existing disassembler or craft my own binary parsers using the format specificatio...

No Matching Function for Call to....

In my object ' handler ' I have the following code: Product tempProduct; // temporary Product storage variable LINE481 tempProduct.setHandler(this); Within my Product.h: #include <string> #include <qtimer.h> #include "HandleTCPClient.h" #ifndef PRODUCT_H #define PRODUCT_H class Handler; //Define ourselves a product class class...

If you had the time and inclination to create a programming language, what characteristics would it have?

Just curious. If you had the time and inclination to create a programming language, what characteristics would it have? One language I would like to see would borrow as much from the syntax of Python as possible but compile to machine code that runs as fast as C or C++. ...

Q_Object with no type...

The error I am receiving: g++ -c -g -I/usr/lib/qt-3.3/include TCPEchoServer.cpp Product.h:22: error: ISO C++ forbids declaration of âQ_Objectâ with no type Product.h:24: error: expected â;â before âvoidâ make: *** [TCPEchoServer.o] Error 1 I'm using QT 3.3. What am I missing...? T___T #include <string> #include <qtimer.h> #i...

Python subclass with C++ baseclass

I have some C++ I have exposed to Python through SWIG. In there is a base class with a single pure virtual function. In Python, I import my module and define a class that uses the abstract class as base. import mymodule class Foo(mymodule.mybase): ... In that module is also a manager class, I want to add my new defined class to t...

How does one return a local CComSafeArray to a LPSAFEARRAY output parameter?

I have a COM function that should return a SafeArray via a LPSAFEARRAY* out parameter. The function creates the SafeArray using ATL's CComSafeArray template class. My naive implementation uses CComSafeArray<T>::Detach() in order to move ownership from the local variable to the output parameter: void foo(LPSAFEARRAY* psa) { CComSafeA...

VC++ 'Generating Code', what does it mean?

WHen compiling in visual studio the compiler outputs this at what seems to be its own discretion: 1>Generating Code... what is it doing here exactly? ...