c++

circular dependency(?) in C++

Hi all, My initial suspicion was that there was a circular dependency in my code and went through http://stackoverflow.com/questions/625799/resolve-circular-dependencies-in-c. But this hasn't resolved my compilation errors. Here is the code with 3 classes - A, G & N. //A.h #ifndef A_H_ #define A_H_ class com::xxxx::test::G; namespac...

mfc42u.dll Error while migrating from VC6 to VS2005

I have migrated my VC6 application to VS2005, all my code got compiled with some changes and there is no compilation error. But I am getting a linking error LNK1104. LINK : fatal error LNK1104: cannot open file 'mfc42u.lib' I have imported the dsw of VC6 in Visual Studio 2005, not sure from where it is still referring to the mfc42u.lib ...

Which is Android/Java corresponding method to the C#/C++ method GetTickCount()?

Well, the title say it all. I wanna know a corresponding method in Android/Java that is like the GetTickCount method in C#/C++? Thanks in advance! ...

C++: What script can I use to test my Apache and FastCGI set up?

I asked at serverfault: How to set up apache with fastcgi and a simple test script? I have been having real difficulties for a couple of weeks trying to understand how to set up my machine so that I can test my C++ application with Apache/FastCGI. I tried with the simplest "Hello World" type of script. The only reply I have had so far...

Can member function arguments be of the same class type ?

//node.h class node { public: void sort(node n); }; I didn't try the code yet . But It's interesting to know if is this a valid case and Why ? Edit : This leads me to another question : Can I declare FOO inside a member function like this ? //FOO.h Class FOO { public: void sort(int n) ; void swap(int x...

Library used to make CCleaner

What kind of library has been used to make CCleaner? ...

Concurrent access to a large collection of items

I'm working on a simulation project using c++ on both windows and linux. There will be several thousand objects (Perhaps 3000-5000) in the simulation. In plan to have several threads performing actions on the objects so that it makes good use of multi core machines, for example one thread handling movement and location of the objects, o...

Detect memory leaks in dbx with new and delete operators

Hello. I'm very interested in using Sun Studio to detect memory leaks in C++ applications with dbx debugger but I think this debugger only shows memory leaks produced by malloc/realloc and free; I'm not sure about this but I've tried with a C++ program and I've obtained no memory leaks. In this case, I'd try Valgrind. If I've done someth...

Design choice when implementing an EXE in a web execution model

I'm designing a component to be run as a backend of a website. The component will take care of some AI logic, and I'm building it under C++. Would it be best if I let each session start a new EXE address space, or the EXE would be up and running and each session will start a new thread? Or is there is any better suggestions alltogether...

Facebook puzzle error: throws it's automated mail regarding build/run error

I solved the problem (Hoppity) as given on Facebook Puzzle Page. I solved it in c++ language (using g++ compiler) and mailed the .cpp file as an attachment to the mentioned e-mail address. I didn't zip the file. After few hours I received a mail regarding run/build error. Can anyone please help me with this. Where m I going wrong? Here...

Can we create a VC++ executable which will work natively on both 32 bit and 64 bit Windows?

Is there any way to build a VC++ project so that the dll/exe created by it will work as a 32 bit application on a 32 bit Windows OS and as a 64 bit application on a 64 bit Windows OS (not in WOW64). I know that is possible for C# applications using the /ANYCPU option. ...

Typedef (alias) of an generic class

Hello, is it possible in C++ to create an alias of template class (without specifying parameters)? typedef std::map myOwnMap; doesn't work. And if not, is there any good reason? ...

Operator precendence in boost::spirit?

I made some tests using the spirit mini_c sample. Unfortunately it does not keep the operator precedence as expected: int main() { return 3 > 10 || 3 > 1; } evaluates to 0. return (3 > 10) || (3 > 1); returns 1 I tried to move the definition of "||" and "&&" to the very top in the constructor of template <typename Iterator> ...

Generate random keys

I was given task to generate random 80 byte keys and i have decided following strateges in my computer sizeof(char)=1 so i have created array of english alphabetical letters char *p=" "; char a[0..26] and in cycle for (int i=0;i<=80;i++){ *(p+i)+= a[(rand()+100) % 26]; } but it does not work it stops execution ple...

C++ Apache API: How to programmatically update apache settings?

This is a nice article about setting up Apache virtual hosts on Debian. Now, I would like to be able to do so programmatically, from within my C++ application. What do I need to know to do so? Sub questions: What tool can I use to parse, read and write the apache config grammar? Is there an API or header I could use to that ...

else statement is seemingly ignored

void PacketRecord::determineAppProtocol() { if (ipProtocol == IP_PROTO_UDP) { std::istringstream ss(udpData); std::string line; if (getline(ss, line) && (line.find("SIP/2.0") != std::string::npos)) { appProtocol = APP_PROTO_SIP; } else { appProtocol ...

Implementing "NOT" in boost::spirit mini_c

I tried to modify the mini_c example of boost::spirit to match to my existing vocabulary. I therefore added a operator "NOT that should behave equal as "!": unary_expr = primary_expr | ("NOT" > primary_expr [op(op_not)]) // This does not work | ('!' > primary_expr [op(op_not)]) | ('-' > p...

Switch inside For loop - Getting weird results in Release mode

Is there anything speaking against a structure like to following. In Release mode, Visual Studio seems to ignore i < 10 and execute the loop without end. If I set a break point I see that i runs from 0 to 9 and stays at 9 in all further iterations. If I printf i, I get a error after the 10 iteration, because arr only has 10 fields. Very ...

Constraint - Derived Class must have a default Constructor

I want to Constraint that the Derived Class must have a Default Constructor. I am currently thinking it in a perverted way template <typename Derived> class Base{ public: Base(){ } virtual ~Base(){ new Derived; } }; Another idea comes to mind is to keep a pure virtual create() method with no arguments. But is...

Boost serialization compiling issue

Hi, I am using boost serialization on windows, and I wanted to test my code on linux (ubuntu) and unfortunately it does not compile. #include <string> #include <fstream> #include <boost/archive/xml_iarchive.hpp> #include <boost/archive/xml_oarchive.hpp> #include <boost/serialization/string.hpp> #include <boost/serialization/nvp.hpp>...