1,177 Posted Topics

Member Avatar for daviddoria

I have a function: void CreateCostGrid(vector<ScanPoint> &Data, int whichcol, vector<LiDARScan> &LiDARGrid); That I call like this: CreateCostGrid(TestScan.getColumn(GoodCols.at(testcol)), GoodCols.at(testcol), ModelScans); But I get this: error: initial value of reference to non-const must be an lvalue CreateCostGrid(TestScan.getColumn(GoodCols.at(testcol)), GoodCols.at(testcol), ModelScans); (There is an arrow underneath the T in TestScan, i guess indicating that …

Member Avatar for Duoas
0
110
Member Avatar for daviddoria

I'd imagine there is a much better way to do this... [code] vector<double> Model; //code to fill Model vector<double> V1; for(int i = StartModel; i <= EndModel; i++) V1.push_back( Model.at(i) ); [/code]

Member Avatar for Narue
0
148
Member Avatar for daviddoria

I want to do something like this [code] #include <string.h> #include <iostream> using namespace std; int main() { MyFunc("test"); return 0; } void MyFunc(const char* Filename) { cout << strcat(Filename, ".tst") << endl; } [/code] but it tells me that my const char* cannot be used where it is expecting …

Member Avatar for Narue
0
106
Member Avatar for daviddoria

This doesn't seem to behave as I would expect (as it does in matlab, for example). I want to execute a command, but give some readable output instead of the often very messy auto-generated error (index out of range or something). [code] try { MyFunction(1,2); } catch(char* str) { cout …

Member Avatar for daviddoria
0
93
Member Avatar for daviddoria

I have to call a function in the form f(void* params) I would like to pass two vector<double> to this function. I suppose I should make a struct struct MyParam_t { vector<double> myvector1; vector<double> myvector2; }; and then somehow fill it and pass it to the function. Someone recommended that …

Member Avatar for Ancient Dragon
0
107
Member Avatar for daviddoria

I ran this: [code] cout << "has nan q?" << numeric_limits<int>::has_quiet_NaN << endl; cout << "has nan s?" << numeric_limits<int>::has_signaling_NaN << endl; cout << "has nan q?" << numeric_limits<double>::has_quiet_NaN << endl; cout << "has nan s?" << numeric_limits<double>::has_signaling_NaN << endl; [/code] and I get 0 0 1 1 why would …

Member Avatar for Salem
0
183
Member Avatar for daviddoria

I have some code like this: [code] vector<double> Saved; for(int i = 0; i<10; i++) { if(some condition on i) Saved.push_back(i); } [/code] Then I want to see what order the things were saved... so naturally I do cout << Saved.at(0) << endl << Saved.at(1) << endl; But to my …

Member Avatar for mitrmkar
0
192
Member Avatar for daviddoria

When trying to compile my code with g++ i get this: MayaFunctions.h:5:27: error: calling fdopen: Bad file descriptor in that line, I simply have #include "AnotherFile.h" Google told me this has something to do with precompiled headers, but I can't figure out how to turn them off. 1) how to …

Member Avatar for daviddoria
0
148
Member Avatar for daviddoria

I keep getting this error: this application has failed to start because MFC80.dll was not found. In the past, when I've got this error i've played around with "Runtime library", switching it from /MDd to /MD to /MTd......etc etc then I turn off and on the manifest files then I …

Member Avatar for daviddoria
0
105
Member Avatar for daviddoria

I seem to be able to write as many characters as I want into "buffer" even though I declare it as length 1 - why is this? [code] string teststring = "teststring"; cout << teststring << endl; char buffer[1]; itoa(34567,buffer,10); teststring.append(buffer); cout << teststring << endl; [/code] Thanks! Dave

Member Avatar for Narue
0
114
Member Avatar for daviddoria

I have 2 classes, Edge and Point. Edge contains Point P1 and Point P2 as private memebers. Edge has accessor functions [code] Point getP1() { return P1; } [/code] and the same for P2. Point has << overloaded - [code] ostream & operator << (ostream &output, Point &p); [/code] I …

Member Avatar for daviddoria
0
134
Member Avatar for daviddoria

I had a global variable that could be seen by all of my functions. I was getting too many functions in the same file, so I made functions.h and functions.cpp. I put the function definitions in functions.cpp and the declarations in functions.h. In main.cpp, I include functions.h. The problem is, …

Member Avatar for daviddoria
0
273
Member Avatar for daviddoria

is there a package for c++ that will allow me to make a matlab/gnuplot style plot from within c++? I would like to skip the step of writing data to a file and then using something else to read in the data and then plot it. Let me know what …

Member Avatar for daviddoria
0
265
Member Avatar for daviddoria

I have a class called MyClass in main, I have [code] MyClass A; //calls the default constructor A.date = 4; [/code] I would like a function to do some stuff and then use one of A's constructors , the result being I have A back in main [code] class MyClass …

Member Avatar for dougy83
0
160
Member Avatar for daviddoria

I found _isnan() in float.h for VS2008, but I would like to SET a variable to a NaN intentionally, not check if it is one. Is this possible? Thanks, David

Member Avatar for daviddoria
0
291
Member Avatar for daviddoria

I made a library (.lib) with VS2005. Is there a way to convert it to a .a linux library without moving the code and setting up a project and compiling in linux? Thanks, David

Member Avatar for Ancient Dragon
0
65
Member Avatar for daviddoria

I am getting a whole bunch of these: warning C4996: 'vsprintf' was declared deprecated see declaration of 'vsprintf' Message: 'This function or variable may be unsafe. Consider using vsprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. I put this at the top of my code: #define _CRT_SECURE_NO_DEPRECATE but nothing changed, I …

Member Avatar for vmanes
0
106
Member Avatar for daviddoria

This is a very general question. I'm sure there is no "right" way so I thought I'd ask for opinions/common practice. In my file MainProgram.cpp (containing main()), sometimes I will have LOTS of functions. It seems very distracting to have a thousand lines of code all in the same file, …

Member Avatar for Narue
0
99
Member Avatar for daviddoria

I wrote a simple class: c:\geometry\Point.h c:\geometry\Point.cpp I made a VS2005 project and added a Source File test.cpp which contains main(). In test.cpp, I #include "c:/geometry/Point.h" When I build the project I get: Unresolved external symbol "public: __thiscall Point::Point(double,double,double)" referenced in function _main. However, if add Point.h to my Header …

Member Avatar for daviddoria
0
112
Member Avatar for daviddoria

Last week I asked about this so I tried to write another example to try it out. I have a Line class which needs to have and members of type Point and member functions that return type Point. The Point class needs to have member functions that return type Line …

Member Avatar for daviddoria
0
407
Member Avatar for daviddoria

I am trying to use OPT++ for multidimensional optimization with Visual Studio 2005. I added the include directory to my project. I added the lib directory to my project. When I try to compile the example that ships with the package, i get 102 of the same error: NEWMAT is …

Member Avatar for zhelih
0
170
Member Avatar for daviddoria

Anyone know a good package that will take a multidimensional function and find its minimum? I can't get opt++ to work under windows. My function is not analytic so the package should have numerical gradient stuff built in. I had no idea this would be so hard to find!

0
51
Member Avatar for daviddoria

I have "right" overloading working fine with: Vector Point::operator*( double P ) this would be called with MyPoint*2 and gives the results I would like. However, if I say: 2*MyPoint, it says I can't do that. Makes sense, but surely this can be done! I had trouble googling because I …

Member Avatar for daviddoria
0
96
Member Avatar for daviddoria

I have a class called Point. Point.h : [CODE] #ifndef POINT_H #define POINT_H #include "Vector.h" #include <iostream> class Point { friend ostream& operator<<(ostream& output, const Point& p) //must have global scope { output << "x: " << x << " y: " << y; return output; } [/CODE] The compiler …

Member Avatar for daviddoria
0
86
Member Avatar for daviddoria

I have a class Vector that needs to have a function that returns type Point, and a class Point that needs to have a function that returns type Vector. I was informed that I needed to use forward references, which I thought I had implemented as follows. I am still …

Member Avatar for mitrmkar
0
110
Member Avatar for daviddoria

Is it possible to make a function with an unknown number of parameters without knowing ANY of them? ie. void Test(...) I know you could do void Test(va_alist) with varargs.h, doesn't make sense that this functionality has been removed does it? Thanks! Dave

Member Avatar for Ancient Dragon
0
93
Member Avatar for daviddoria

Is there a way to interpolate between RGB values? I have a set of values that I want to map (linearly or otherwise) to colors from a color_min RGB triple to a color_max RGB triple. Since RGB is not "incrementable", how would I do this? Thanks, David

Member Avatar for Duoas
0
105

The End.