c++

returning a std::string with an vector

hi, I'm trying to get "CMtoaPlugin::listArnoldNodes()" to return an "array" of strings std::vector<std::string> ArnoldNodes = CMtoaPlugin::listArnoldNodes(); std::vector<std::string>::iterator it; for ( it=ArnoldNodes.begin() ; it < ArnoldNodes.end(); it++ ) { printf("initialize shader %s\n", *it); } but this is ...

C++ dynamic binding

How can C++ achieve dynamic binding yet also static typing? ...

Template argument missing for boolean operator?

I'm currently creating a circular doubly-linked list as exercise. The exercise is templating the damn thing, which is proving to be quite a pain. After many, many, many error-removals I get more errors. I'd laugh at that, but I'm quite tired and exhausted now. Node.h template<class T> class Node { public: Node(T val) : data(val), n...

ARToolkit and a projector... discuss!

Hello everyone, I'm going to try to explain my situation as clearly as possible. I'm not looking for solutions, but for ideas that can give me some direction as what to do. What I have seen on the web is that AR is usually done with a webcam feed on a screen or with a head mounted display. In this case, we want to overlay simple object...

Debugging VB6 in VS2008 with non-VB6 objects

Hi there, I have an exe in Csharp that references a C++ dll and a VB6 dll. I can successfully step into the C++ from the Csharp in Visual Studio 2008 when I open the corresponding files. I achieved the same ability to step into the VB6 from the Csharp by generating a pdb file along with the VB6 dll. The only issue I have is that when ...

c++ virtual functions.

Just wondering, what would be fastest? If I had a base class like this Class Base { virtual void Draw() { //something... } }; Then I would have an array of Base like this: Base Array[255]; Which could contain both Base and it's derivatives. This would be one way of for example, storing various drawing commands. (I know this would s...

C++ msvcp90d.dll Access violation exception

I was writing a c++/cli wrapper for a native c++ application, and when I finished writing code, it builds so well. The native c++ is built to a static library (.lib) file, and I referenced it in my c++/cli wrapper, then I wrote a c# console application to test the wrapper. However, the debugger can be launched.If I commented the lines w...

How to add element by element of two STL vectors?

The question is quite dumb, but I need to do it in a very efficient way - it will be performed over an over again in my code. I have a function that returns a vector, and I have to add the returned values to another vector, element by element. Quite simple: vector<double> result; vector<double> result_temp for(int i=0; i< 10; i++) resul...

ms vc++ iostream compile error

The following code in microsoft visual C++ 2010 express: #include <iostream> //using namespace std; int main(int argc, char **argv) { return(0); } gives me the errors: 1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\cmath(19): error C2061: syntax error : identifier 'acosf' ... 1>C:\Program Files\Microsoft Visual Stud...

Storing struct instances in a std::map

I'm trying to map some structs to some other instances, like this: template <typename T> class Component { public: typedef std::map<EntityID, T> instances_map; instances_map instances; Component() {}; T add(EntityID id) { T* t = new T(); instances[id] = *t; return *t; }; }; Then I use ...

Performance difference for multi-thread and multi-process

Few years ago, under Windows environment, I did some testing, by letting multiple instance of CPU computation intensive + Memory access intensive + I/O access intensive application run. I develop 2 versions. One is running under multi-process, another is running under multi-thread. I found the performance is much better for multi-proces...

blink LED uisng vc++

hello all, I am new to vc++, I have to create a simple vc++ application so that I can turn off or turn on an LED ( or an electrical bulb powered by a cell), How can I take the control out from my program, I would like to use a USB for connecting the output. Is there any library available for implementing USB integrating in the progra...

C++ 5 dimensional vector ?

I am trying to make a 5 dimensional vector and I can’t seem to get it to work. I know if I need to write a 3 dimensional vector, I could write it in the following way: vector< vector< vector<string> > > block(27, vector< vector<string> > (27, vector<string>(27))); Then I call it: block[x][y][z] = “hello”; I wrote the 5 dimensional v...

glibc detected *** ./a.out: free(): invalid pointer:

when i compiled(c++ program) in linux i am getting following error pls help me glibc detected *** ./a.out: free(): invalid pointer:0x0804878d *** ======= Backtrace: ========= /lib/libc.so.6[0xbd5f18] /lib/libc.so.6(__libc_free+0x79)[0xbd941d] /usr/lib/libstdc++.so.6(_ZdlPv+0x21)[0x3233fe1] ./a.out(__gxx_personality_v0+0x100)[0x8048514]...

C++: Copy containers efficiently

How do you copy your STL containers? // big containers of POD container_type<pod_type> source; container_type<pod_type> destination // case 1 destination = source; // case 2 destination.assign(source.begin(), source.end()); // case 3 assumes that destination.size() >= source.size() copy(source.begin(), source.end(), destination.size(...

C++ Syntax question regarding constructor's member initialisation list and throw

How do I write a ctor definition which has both throw and a member initialisation list? Is this correct? ClassName::ClassName(int parameter): datamember_(parameter) throw(ExceptionType) ...

Embed C++ Libraries into .Net Libraries

In my .Net assemblies I would have to make use of some native (C++ ) dlls. Usually we need to copy the C++ dlls into the bin folder and use PInvoke to call it. To save the distribution cost, I want to embed the C++ into my .Net dll direct, so that the number of assemblies distributed would be less. Any idea how to do this? ...

Tutorials for Visual Studio 2010 Ultimate Profiler?

Hi! From what I've seen on this site, most of the people believe that first step when optimizing a program is to profile it so I decided to learn how to do that in VS2010. So are there any tutorials on Internet or books which explain what is what in profiler? ...

How do I set up OpenGL with SDL?

I have been tinkering with SDL for a few days now and I have hit a roadblock. It seems that rotating 2D sprites is very costly and, in a practical sense impossible with just plain SDL. After a great deal of reading, it seems that OpenGL, utilizing the hardware (as opposed to just a pure software solution) is the correct tool for the job....

i want to study win32 programming

i want to study win32 programming(windows form applications) please advise me good sites or good book (language c++) ...