I'm porting code that uses a very large array of floats, which may trigger malloc failures from c to c++. I asked a question about whether I should use vectors or deques and Niki Yoshiuchi generously offered me this example of a safely wrapped type:
template<typename T>
class VectorDeque
{
private:
enum TYPE { NONE, DEQUE, VECTOR };
...
I've written some ObjC unit tests for use with the OCUnit support in Xcode. Now I would like to do the same for some of the C++ code I'm about to write (a separate static library).
Is there any support for e.g. CppUnit (or some other C++ test framework) in Xcode? When I write support, I mean I want to run the tests and display the resul...
I am tring to compile and my C++ program on Linux using gcc command.
I used gcc -lm MyOwn.c Main.c -o Out
Myown.c is another file I should link to the main.
The Out file is successfully created.
The problem is Out does not run.
When I tried to use gcc or cc to create exe file it gives me a lot of errors
Can someone help me?
...
In the following code, I am trying to get a folder location from the user. However, when I selected E:\ in the folder browser, szAbsolutePath doesn't give me the path for the CD burner temporary folder. This prevents me from saving to this location. However, if I choose something like E:\folder1\, I get the full path and can write out fi...
I have a Windows Mobile 6.5 application where I'm trying to monitor a file for changes. If I run the code below, then open WordPad and edit and save "\MyDir\Foo.txt", I only get notifications about temporary files being changed.
For reference, I'm using Windows Mobile 6.5 Professional CE OS 5.2.23090.5.3.0. And, I have the same issue w...
I'm ending my first internship and my boss has shown me a few of his own programming techniques, but one bothers me some. When I write a class header, I like the corresponding source file to linearly list the functions in order that they were declared in the header file. Every time I add a function to the source file, I put it in the ord...
How can i build a boost library date_time using bjam for vc80.
currently I am using
..\bjam.exe release debug threa
ding=multi --toolset=msvc-8.0 stage --with-date_time --build-type=complete --deb
ug-configuration -d+2
This only generates libraries with the vc7.1 version, what I need is vc80.
I also noticed that the v1 verion Boost.Bu...
I'm going to be using a subset of C++ (working within some of the ideas in Elements of Programming), but I haven't used C++ in years. I'm going to be writing a highly parallel algorithm on a 100+ nodes system with shared memory. The nodes are Mac OS X, but I have access to *nix and windows machines, too.
Do people have suggestions for e...
hey, i am trying to allocate a dynamic matrix on the heap and seems like i am doing something wrong.
i try to do the following thing :
vector< vector<int*> >* distancesMatrix=new vector< vector<int*> >;
it does allocate a matrix on the heap but the matrix itself is empty, i want the matrix to be sizeXsize but cant sort it alone
when ...
When I clone an ID3DXMesh with blend weights the blend weights end up breaking (but not completely, mostly the arms and fingers are skewed in strange directions), my code is very simple:
LPD3DXMESH pTempMesh;
if( model /*model is a mesh with animations, bone hierarchy, etc))
{
if ( FAILED ( model->CloneMesh( model->GetOptions(), pDe...
hey, sorry for this but i'm trying to figure out what's the problem for too long, if you can spot a clue from this long error message i will be thankful
Error 6
error LNK2019: unresolved external symbol "public: __thiscall Adjutancy::Adjutancy(class std::set<class Vehicle *,struct CompareCatId,class std::allocator<class Vehicle *>...
I'm trying to do some simple image processing using opengl. Since I couldn't find any good library that does this alrdy I've been trying to do my own solution.
I simply want to compose a few images on the gpu and then read them back. However the performance of my implementation seems almost equal to what it takes do on the cpu... someth...
Hey everyone,
I'm trying to compile a C++ library (VRPN) with a couple of Java wrappers to be used in an Android app. Using the ndk-build command, I get an "undefined reference" error for the first line of my C++ interface file which references a constructor for an object in the library. I am fairly sure my code is correct - the call ...
I have to deal with a huge amount of data that usually doesn't fit into main memory. The way I access this data has high locality, so caching parts of it in memory looks like a good option. Is it feasible to just malloc() a huge array, and let the operating system figure out which bits to page out and which bits to keep?
...
error C2664 : 'void std::vector<_Ty>::push_back(_Ty&&)': cannot convert parameter 1 from 'Node *' to 'Node&&'
please I need help...
I created node.h & heap.h
node.h :
#ifndef __NODE_H_
#define __NODE_H_
#include <string>
#include <iostream>
using namespace std;
template <class T>
class Node {
private:
Node<T>* m_brother;
int...
Hey,
I am trying to preform operator overloading in C++;
for some reason the compiles keeps on giving me the error
error: ‘bool Matrix::operator==(const Matrix&, const Matrix&)’ must take exactly one argument
Now, I know that there is some way to to it with one argument using this, but I understood that by using friend I can do i...
The following code tests the use of std::map with std::string as a key:
#include <stdio.h>
#include <map>
#include <string>
using namespace std;
typedef map<string, int> test_map_t;
int main(int argc, char **argv) {
test_map_t test_map;
test_map["test1"]= 1;
test_map["test2"]= 2;
test_map["test3"]= 3;
str...
I've been testing out clang-llvm to see if it is worth it to mention to my school's IT department to add it to the machines we students program on. For all of our assignments, we are required to compile using g++ -Wall -W -pedantic-errors *.cpp, so I just converted the command to clang++ -Wall -W -pedantic-errors. I got some output that ...
Would I would like to be able to do is convert a char array (may be binary data) to a list of HEX values of the form: ab 0d 12 f4 etc....
I tried doing this with
lHexStream << "<" << std::hex << std::setw (2) << character << ">";
but this did not work since I would get the data printing out as:
<ffe1><2f><ffb5><54>< 6><1b><27><46><f...
Hello,
I'm programming some unit test with google test framework. But I want to check is some asserts are well placed and are useful. So my question is: does exists a way to catch an assert in google test?
Example:
int factorial(int n){
assert(n >= 0);
//....
}
And then the test:
#include <gtest/gtest.h>
TEST(FactorialTest,...