c++

GLUT Matrix multiplication to rotate an object in its own axis without using glRotate

*I say rotating an object on its own axis but I think my term is wrong...what I mean by that is like rotating my object from the objects center and not at the origin I'm trying to make a program that rotates my object(made by using a matrix of points/vertices) in its *own axis without the use of glRotate or glTranslate What I did was to...

How to convert a floating point value in exponential form to dot notation?

Possible Duplicate: Prevent scientific notation in ostream when using << with double I get 1e-1 as result after a computation how can I convert the result from exponent to dot notation i.e., 0.1 ? Why is it automatically converted to exponential notation!! ...

"too many template-parameter-lists" error when specializing a member function

Hi All, I would like to define some template member methods inside a template class like so: template <typename T> class CallSometing { public: void call (T tObj); // 1st template <typename A> void call (T tObj, A aObj); // 2nd template <typename A> template <typename B> void call (T tObj, A aObj, B bObj); // 3r...

Combine multiple DLL's into 1

Hi, I'm wondering if it's possible to combine multiple DLL's into 1. I'm currently working on a C++ project that is dependent on many dynamic link libraries,so would it be possible to combine them into 1 DLL file, and if so, how would I do that? ...

xcode's executable product for c++ project

Hello, everyone... I've completed a simple numbers-version of the game "Towers of Hanoi" using xcode's command line tool in C++. Being accustomed to PC compilers like borland's and visual-c, I've attempted to "share" the game with others via e-mail by simply attaching the executable product built by xcode. However, the recipients can't ...

Modules in C++0x

Hi, I just discovered this old C++0x draft about modules in C++0x. The idea was to get out of the current .h/.cpp system by writing only .cpp files which would then generate module files during compilation, which would then in turn be used by the other .cpp files. This looks like a really great feature. But my question is: why did the...

Newbie problem with QT C++ - Qimage dont work?

I am trying to do console application to read pixels from image: #include <QtCore/QCoreApplication> #include <QtGui/QImage> #include <iostream> int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QImage *img = new QImage("adadad.jpg"); //std::cout << "Type filename:" << std::endl; img->isNull(); ret...

Which code apps you would say are better to start with?

Possible Duplicate: Which IDE is best for C++ ? I am just starting in the Computer Science scene and would like to know about a specific app I could use to just start writing codes. ...

Confused in using opensource 3rd party libraries

How do you integrate C or C++ open-source third party libraries in your projects? Do you copy all the files it comes with (i.e. README, makefiles etc) to a separate directory somewhere inside the project and build it using its configs? Or do you only get needed source files and headers from a source package? Or do you just install pre-bu...

Getting type of an object

I'm trying to do something along these lines: int var = 5; std::numeric_limits<typeid(var)>::max(); but surprise, surprise it doesn't work. How can I fix this? Thanks. ...

Is it possible to read an LLVM bitcode file into an llvm::Module?

I'm writing a compiler with LLVM. Each source file is compiled into an LLVM bitcode file. Eventually the linker links and optimizes all the bitcode files into one final binary. I need a way to read the bitcode files in the compiler in order to access the type information. The LLVM documentation shows a class called BitcodeReader, but th...

overloading operator+ (C++)

Hey so I am working on an overload of +, but when I try to do a simple call like statistician a,b,c; a = b+c; When I do the above call it crashes. and if i do an overload of =, it just returns a zero. here is some of my code. Thanks for the help guys!!! FYI next_number(double value), increases the dynamic array by 1, and puts that ...

Variables addresses

Hello, I'm writing statistic system. It should make some output with given params. For example: float getSunActivity() { ... } int getEarthActivity() { ... } StatisticSystem::track("sun_activity", boost::any(getSunActivity())); StatisticSystem::track("earth_activity", boost::any(getEarthActivity())); class StatisticSystem { typedef...

Negative NaN is not a NaN?

While writing some test cases, and some of the tests check for the result of a NaN. I tried using std::isnan but the assert failes: Assertion `std::isnan(x)' failed. After printing the value of x, it turned out it's negative NaN (-nan) which is totally acceptable in my case. After trying to use the fact that NaN != NaN and using ass...

Using WSASend & WSARecv to transfer binary data

I tried the MSDN code edited that, but still the problem is that when I send 271 bytes data, my WSARecv() shows me 542 byte data, which is just duplicate copy. How can I overcome this problem? http://msdn.microsoft.com/en-us/library/ms741688(v=VS.85).aspx http://msdn.microsoft.com/en-us/library/ms742203(v=VS.85).aspx ...

data structure for storing array of strings in a memory

Hi everyone! I'm considering of data structure for storing a large array of strings in a memory. Strings will be inserted at the beginning of the programm and will not be added or deleted while programm is running. The crucial point is that search procedure should be as fast as it can be. Saving of memory is not important. I incline to s...

Several C++ classes need to use the same static method with a different implementation.

I need several C++ classes to have a static method "register", however the implementation of register varies between those classes. It should be static because my idea is to "register" all those classes with Lua (only once of course). Obviously I can't declare an interface with a static pure virtual function. What do you guys sugges...

What's the graceful way of handling out of memory situations in C/C++?

I'm writing an caching app that consumes large amounts of memory. Hopefully, I'll manage my memory well enough, but I'm just thinking about what to do if I do run out of memory. If a call to allocate even a simple object fails, is it likely that even a syslog call will also fail? EDIT: Ok perhaps I should clarify the question. If ma...

How to implement a hello world shared memory in c/c++ in windows?

Is shared memory stable at the first place? I prefer this way to inter-process/application communication because that way I don't need the overhead of parsing data. Is there a good hello world demo on this in c/c++? ...

C++ clock() function giving incorrect values

I was trying to program a Timer class (unaware that boost had one), then when that wasn't working, I tried to just output the value of clock(), using this code: #include <ctime> #include <iostream> int main() { for(int i = 0; i < 50; ++i) { std::cout << std::clock() << " "; } return 0; } When I run the program, I get a series o...