c++

How do I trace into an externally-compiled lib in Visual C++

I built the non-dll version of OpenSSL on my windows box. Per the instructions I modified the build script to include debug symbols. I can link against them fine and they run. But when I try to step into an openssl function from my cpp code it just steps over. I know this is a total noob question but how do I fix this? I have all th...

How to statically link using link.exe

I've been trying to statically link against a C++ library called Poco on Windows using the Visual Studio 2008 command line tools. I build my program with: cl /I..\poco\lib /c myapp.cpp link /libpath:..\poco\lib myapp.obj PocoNet.lib This results in an exe that at runtime requires PocoNet.dll and PocoFoundation.dll. I spent some time...

Edited most errors, Now Compiles, but does not Run, what am I doing wrong?

#include <cstdlib> #include <iomanip> #include <iostream> #include <string> using std::cout; using std::cin; using std::endl; using std::string; using std::setprecision; using std::fixed; //function prototypes void getInput(string &, double); void calcFedTaxes(double , double, double &, double &); void calcnetPay(double &, double...

[C/C++] somehow register my classes in a list

Hi, I would like to be able to register my classes within a std::map or a vector, don't think about duplicates and such for now. but I don't want to register it within the class constructor call or any within function of the class, somehow do it outside the class so even if I never instanciate it, I would be able to know that it exists....

how to build a vector of different objects after reading a file

Hello, everyone! I am new for C++ and now work on a C++ project.The whole structure has been completed.But I have been wondering about how to build the vector of different objects and how to read the file since the beginning. In my problem, first I have to read a txt file with readObstacles(std::istream &fs) that has the following for...

What 3D graphics framework should I use for a real world game engine?

Hello, I'm a C++ programmer with very extensive server programming experience. I'm however fairly bored at the moment and I decided to tackle a new area: 3D game programming, for learning purposes. Additionally I think this learning project may turn out to be good resume material in the future should I decide to work in this area. Inste...

Using Qt to make an almost native Windows Application?

I love that Qt is cross-platform but I want to make an application that will call into some Windows specific .dll's. Kinda like Google Chrome does with the glass on Windows Vista/7 (I know Chrome isn't written using the Qt framework just thought it was a good example). How can I do this in Qt? Is it feasible? ...

What questions should an expert in STL be expected to answer, in an interview

I was looking at a job posting recently and one of the requirements was that a person be a 9/10 in their knowledge of STL. When I judge my skills, to me a 10 is someone that writes advanced books on the subject, such as Jon Skeet (C#), John Resig (JavaScript) or Martin Odersky (Scala). So, a 9/10 is basically a 10, so I am not certain ...

Visual C++ 2008 as frontend for Access

I am working on a database project that requires me to code in C++. I have the framework for the relational database built using Microsoft Access. Since I would like a GUI for the user, I am trying to use Visual C++ 2008 to build it. I have tried to build a solution as a win32 console app, MFC app, and CLR app, each halting me with thei...

What is an example of user documentation??

Hi, I'm writing this Rational number class for one of my cs courses, using C++. We're also asked to hand in a "user documentation", which is sth that i've never done before. What is an example of user documentation? what is the format of it? Thanks! ...

How Non-Member Functions Improve Encapsulation

I read Scott Meyers article on the subject and quite confused about what he is talking about. I have 3 questions here. Question 1 To explain in detail, assume I am writing a simple vector<T> class with methods like push_back, insert and operator []. If I follow mayers algorithm, I would end up with all non-member friend functions. I w...

Erasing a vector element by key

ive defined the following and filled it with elements: vector <vector<double> > my_vector; but i want a delete an element with a specific key... my_vector.erase(int(specific_key)); but it doesnt allow me. how would i properly dispose of the elements assigned to that key properly? ...

Best way to convert epoch time to "real" date/time

What I want to do is convert an epoch time (seconds since midnight 1/1/1970) to "real" time (m/d/y h:m:s) So far, I have the following algorithm, which to me feels a bit ugly: void DateTime::splitTicks(time_t time) { seconds = time % 60; time /= 60; minutes = time % 60; time /= 60; hours = time % 24; time /= 24;...

Dynamic Memory Allocation in C++

What is the difference between the 'delete' and 'dispose' C++ operators with regards to dynamic memory allocation? ...

Why do I get a "constant too large" error?

I'm new to Windows development and I'm pretty confused. When I compile this code with Visual C++ 2010, I get an error "constant too large." Why do I get this error, and how do I fix it? Thanks! int _tmain(int argc, _TCHAR* argv[]) { unsigned long long foo = 142385141589604466688ULL; return 0; } ...

Aligning a class to a class it inherits from? Force all stack alignment? Change sizeof?

I want to have a base class which dictates the alignment of the objects which inherit from it. This works fine for the heap because I can control how that gets allocated, and how arrays of it get allocated in a custom array template. However, the actual size of the class as far as C++ is concerned doesn't change at all. Which is to say i...

Declaration inside if/switch

I'm trying to do something like this in C++: if(){ int a; } else if(){ char a; } else { double a; } f(a); But I get an error from the compiler saying that a was not declared in this scope. I need to do a conditional declaration, how can I do it? Many thanks edit: I cannot move the function inside the conditional as the ...

how to solve linear equations using genetic algorithm

hello i want to solve a system of n linear equations containing n variables using genetic algorithm. i am having difficulty in defining the crossover operation as the solution may consist of floating point values. how do i proceed. seems possible but this is my first encounter with genetic algorithms so your help would be great. suppos...

Compiling a shared library with Qt on Ubuntu 9.10

I am new to both Qt and Linux C++ development (although I have many years C and C++ development experience on Windows). I have some legacy C projects (source files and headers - [not using Qt]) that I want to compile into shared libs on Linux. I am proposing to store my projects under the following structure: /home/username/Projects/p...

How to instantiate MsftRawCDImageCreator?

I'm trying to write a program in C++ that is able to burn an Audio CD without gaps between the tracks. From what I found, this has only recently been made possible using IMAPI, but should be possible since Windows XP SP2 and Vista SP1. The problem is that I can't find any example code on how to do this. What I did find is that I need to...