1,177 Posted Topics

Member Avatar for goulda660

You did not post clear.h as far as I can tell. I STRONGLY encourage you to use the "this" pointer explicitly. e.g. in data::lookup() - [icode] std::ifstream lookup( this->name ); [/icode] instead of [icode] std::ifstream lookup( name ); [/icode] It makes code much more readable. Also, you'll get a bunch …

Member Avatar for daviddoria
0
208
Member Avatar for timbomo

I suggest making the smallest compilable code that demonstrates your problem (< 15 lines). It will help you narrow down where the problem is, and if you still can't figure it out, it will save us massive time helping you debug it. Dave

Member Avatar for timbomo
-1
94
Member Avatar for hazemahmed16

I recommend posting this question here: [url]http://tech.groups.yahoo.com/group/OpenCV/[/url]

Member Avatar for hazemahmed16
0
94
Member Avatar for paraboloid
Member Avatar for dusktreader
0
122
Member Avatar for buzzykerbox
Member Avatar for buzzykerbox
0
101
Member Avatar for NotSneaky

I suggest you start by stripping the code down to the smallest portion that compiles successfully and add code line by line until it breaks. That should give you some hints about where the problems are.

Member Avatar for NotSneaky
0
213
Member Avatar for gnarlyskim

In the constructor, you would probably want to set all of the coefficients to 0. The idea is just that you really NEVER want to have unassigned variables. What if you forgot they were assigned in the read function and tried to access them before that? You would end up …

Member Avatar for gnarlyskim
0
141
Member Avatar for wwsoft

[code] #include <cmath> #include <iostream> int main() { double x1 = 0; double y1 = 0; double x2 = 100; double y2 = 100; std::cout << 180./3.14159 * atan((x2-x1)/(y2-y1)) << std::endl; return 0; } [/code] The answer is 45 not 315 going from (0,0), to (100,100), right? Dave

Member Avatar for daviddoria
0
168
Member Avatar for Tech E

I'd really recommend getting the problem down to a <20 line example that we can look at. Dave

Member Avatar for WaltP
0
172
Member Avatar for Phil++

I'd agree with the second sentence. I wouldn't say anything about allocating memory. Dave

Member Avatar for WaltP
0
82
Member Avatar for RayvenHawk

Those are linker errors. You need to go into your project settings and make sure you are linking to COMCTL32.LIB and USER32.LIB. Dave

Member Avatar for daviddoria
0
146
Member Avatar for daviddoria

After reading a few tutorials, it looks like this: [url]http://www.rpi.edu/~doriad/Examples/Table/[/url] should make a full (100%) width table. However, the width is actually very small and the table is on the left of the page. Does anyone see what is wrong here? Thanks, Dave

Member Avatar for almostbob
0
102
Member Avatar for endframe

That seems to be the least of your problems. You'll notice that this won't compile: [code] #include <iostream> void maxmin(struct ma mx); int main() { return 0; } void maxmin(struct ma mx) { int max=mx.ev[0]; int min=mx.od[0]; for (int i=0;i<10;i++) if (mx.ev[i]>max) max=mx.ev[i]; for (int j=0;j<10;j++) if (mx.od[j]<min) min=mx.od[j]; cout<<"The …

Member Avatar for endframe
0
341
Member Avatar for daviddoria

This code: [code] #include <iostream> class Parent { int name; class Child { int school; void test() { std::cout << this->name; } }; }; int main(int argc, char *argv[]) { Parent MyParent; return 0; } [/code] Generates this error: [code] error: 'class Parent::Child' has no member named 'name' [/code] Is …

Member Avatar for HealBrains
0
174
Member Avatar for daviddoria

I have some code that uses _finite (I think from float.h) that my linker complains is not declared. I think this might be a "windows only" function. Is there an equivalent function that I can call that will work cross platform? Thanks, Dave

Member Avatar for daviddoria
0
216
Member Avatar for daviddoria

I am trying to compile some old code a colleague gave me. I have MyClass.h [code] class MyClass { public: static int UseIndex; .... }; #include "MyClass.inl" [/code] MyClass.inl [code] ... int TreeNodeData::UseIndex=1; ... [/code] I am getting: [code] multiple definition of `MyClass::UseIndex' first defined here [/code] I got several …

Member Avatar for daviddoria
0
221
Member Avatar for daviddoria

I am trying to get a variable number of arguments in one function, and pass them to another function. I tried this: [code] #include <iostream> #include <stdarg.h> void Function1(unsigned int num, ...); void Function2(unsigned int num, va_list ap); int main(int argc, char *argv[]) { Function1(3, 1, 2, 3); return 0; …

Member Avatar for daviddoria
0
234
Member Avatar for daviddoria

When compiling some working code on Fedora 11, I am getting this error: [code] /usr/include/c++/4.4.1/cstdarg:56: error: ‘::va_list’ has not been declared [/code] I am using: [code] [doriad@davedesktop VTK]$ g++ --version g++ (GCC) 4.4.1 20090725 (Red Hat 4.4.1-2) [/code] Does anyone know what the problem could be? Thanks, Dave

Member Avatar for daviddoria
0
1K
Member Avatar for daviddoria

I am trying to compile some software I found online. I am getting a bunch of these errors: [code] No rule to make target `/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stdarg.h', needed by `formCluster.o'. Stop. [/code] In the Makefiles, there are certainly lines like this: [code] transform.o: /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stddef.h [/code] The errors seem to go away if …

Member Avatar for daviddoria
0
403
Member Avatar for daviddoria

I am trying to get some code I found online to compile. It looked like this: [code] #include <iostream> #include <list> using std::list; template <class T> class leda_list : public std::list<T> { private: iterator loopIter; [/code] the error was: ‘iterator’ does not name a type I tried changing it to: …

Member Avatar for daviddoria
0
272
Member Avatar for daviddoria

I want to make a type to differentiate degrees and radians. I wanted something like this to produce a compiler error: [code] #include <iostream> typedef double Degree; typedef double Radian; void MyFunction(Radian angle); int main() { Degree foo = 3.0; return 0; } void MyFunction(Radian angle) { std::cout << "Success." …

Member Avatar for Narue
0
109
Member Avatar for shethia.tejas

Some libraries that you may find helpful: ITK: [url]http://itk.org/[/url] VIL (part of VXL): [url]http://vxl.sourceforge.net/[/url] OpenCV: [url]http://opencv.willowgarage.com/wiki/[/url] CImg [url]http://cimg.sourceforge.net/[/url] Hope that helps. Dave

Member Avatar for daviddoria
0
159
Member Avatar for daviddoria

If I go to: view -> arrange by -> current view -> customize current view -> other settings I can change the "row font" size for the current folder. If I have 100 folders and I want to change the font size for the messages in all of them, you …

0
955
Member Avatar for daviddoria

Why people write such cryptic code I will never understand... Can someone explain what is going on in the following: [code] double color = {1,2,3}; double *ptr; // ... assign ptr .... *ptr = *color++; ptr++; [/code] So this line [icode] *ptr = *color++; [/icode] sets the value of the …

Member Avatar for kvprajapati
0
131
Member Avatar for daviddoria

Is there a way to see what a macro gets expanded to? I tried to put it in quotes and use printf, but of course printf just printed exactly the string. The result of: [code] #define SetMacro(name,type) \ virtual void Set##name (type _arg) int main() { printf("SetMacro(Test, int)"); } [/code] …

Member Avatar for daviddoria
0
138
Member Avatar for daviddoria

A friend of mine has a big table on his website: [url]http://www.rpi.edu/~chens/Research.html[/url] I think it looks great, so I tried to copy this style/code, but it is making too many columns: [url]http://www.rpi.edu/~doriad/TechnicalReports.html[/url] I read [url]http://www.w3.org/TR/html4/struct/tables.html[/url] , but it looks to me like I have done everything right (all it is …

Member Avatar for almostbob
0
74
Member Avatar for daviddoria

I have some sections like: [code] <h3>EngineeringNotes.net</h3> <br>I have never .... [/code] (see this page: [url]http://www.rpi.edu/~doriad/Personal.html[/url]) Why is there such an enormous space between the header and the text? I thought <br> should just insert a single line break? Thanks, Dave

Member Avatar for daviddoria
0
67
Member Avatar for Mahsa_C++

Please post the code for the constructor - you have posted only declaration, no definitions, so we can't see what is going on!

Member Avatar for Mahsa_C++
0
459
Member Avatar for daviddoria

Consider two classes, PersonClass and LawyerClass. If LawyerClass derives from PersonClass, you can create a PersonClass* as a LawyerClass, like [code] PersonClass* Person = new LawyerClass; [/code] then you can convert it to a LawyerClass* with [code] LawyerClass* Lawyer = static_cast<LawyerClass*>(Person); [/code] However, if you don't know that the person …

Member Avatar for daviddoria
0
5K
Member Avatar for daviddoria

Say you have a class that has members [code] private: double a,b,c,d,e,f,g,h,i; [/code] You can make an accessor like: [code] double operator[](int index) { if(index == 0) return a; else if(index == 1) return b; else if(index == 2) return c; } [/code] But how would you do something like …

Member Avatar for Narue
0
97
Member Avatar for daviddoria

If I have the following setup: [code] Point* MyPoint = Object->GetMyPoint(); if(MyPoint->GetValue() != 2) do something; else do something else; [/code] If MyPoint is NULL or invalid, the MyPoint->GetValue() will cause a segfault. This should fix it: [code] Point* MyPoint = Object->GetMyPoint(); if(MyPoint) { if(MyPoint->GetValue() != 2) do A; else …

Member Avatar for JasonHippy
0
122
Member Avatar for Phil++

First of all, you should [icode]#include <iostream>[/icode] instead of [icode]#include <iostream.h>[/icode]. This is the "new" c++ way to do it. Second, you have to [icode]#include <cstring>[/icode] to use strcpy. Third, you have not declared getHours in the header file. To show you this, the compiler says: "error: no 'int Person::getHours()' …

Member Avatar for pecet
0
59
Member Avatar for gretty

You need to give us more of a feeling that you have really tried. Did your code produce errors? Or incorrect results? Why don't you try some simple cases like the number '4'. You should expect to see factors of 2 and 2, right? Small examples like these will help …

Member Avatar for mrnutty
0
150
Member Avatar for jmoran19

I don't understand why you would want to remove stl features? They make things MUCH easier...

Member Avatar for daviddoria
1
315
Member Avatar for Ponomous

I don't understand the problem... [code] int NumberOfPositiveRoots(root1, root2) { int counter = 0; if (root1 >= 0) { counter++; } if (root2 >= 0) counter++; } return counter; } [/code]

Member Avatar for Ponomous
0
121
Member Avatar for jjf3rd77

What you have there is simply a hard coded triangle. You need to write the code to setup the triangle's height and width. Give it a shot and post your problem once you try it.

Member Avatar for jjf3rd77
0
144
Member Avatar for INTIKHAB

Please explain exactly what you need. What operating system are you using?

Member Avatar for pspwxp fan
-6
108
Member Avatar for daviddoria

Is there a "correct" way to draw a line betwee the header and body of a document in word 2007? I've been using a Shapes->Lines line, but it seems silly because there is no way to center it, etc. Any ideas? Thanks, Dave

0
66
Member Avatar for daviddoria

With this code: [url]http://www.rpi.edu/~doriad/Daniweb/maxflow/[/url] If I run [code] g++ Example.cpp graph.cpp [/code] with g++ 3.3, everything works fine. However if I run the same command with g++ 4.4, I get this error: [code] Example.cpp:(.text+0x38): undefined reference to `Graph<int, int, int>::Graph(int, int, void (*)(char*))' [/code] Does anyone know how I can …

Member Avatar for StuXYZ
0
132
Member Avatar for daviddoria

I have written an integration function (of one variable) [code] double integrate(double (*f)(double), const double a, const double b) [/code] However, now I want to integrate a function of one variable, but the c++ function has an additional parameter: [code] double f(double x, bool flag) { if(flag == true) f …

Member Avatar for mrnutty
0
280
Member Avatar for daviddoria

With normal folders, you can right click them and say "Remove from favorite folders, as per here: [url]http://office.microsoft.com/en-us/outlook/HA011176721033.aspx[/url] However, Calendar and Contacts don't have that option. How would one remove them? Thanks, David

Member Avatar for caperjack
0
236
Member Avatar for daviddoria

I am looking at some open source code and I am a bit confused. There is an Allocator class: [code] class Allocator{ [/code] Then in another class, they have: [code] class Octree{ public: static Allocator<OctNode> Allocator; [/code] When trying to compile, I am getting: [code] error: declaration of 'Allocator<OctNode<NodeData, Real> …

Member Avatar for StuXYZ
0
107
Member Avatar for daviddoria

I am trying to compile some code (Example.cpp from here: [url]http://www.rpi.edu/~doriad/Daniweb/maxflow/[/url]). I am getting [code] Example.cpp:(.text+0x38): undefined reference to `Graph<int, int, int>::Graph(int, int, void (*)(char*))' [/code] This is clearly a template instantiation problem. I see that there is a file called instances.inc that defines the <int,int,int> class, do I need …

Member Avatar for dkalita
0
393
Member Avatar for daviddoria

Is there anyway to get images to be the "correct" size - i.e. fit the width of the text? This is what currently happens: [url]http://engineeringnotes.net/personal/pictures.shtml[/url] Thanks, Dave

Member Avatar for Troy III
0
134
Member Avatar for daviddoria

I'm still very new to css, so I'm sure this is just some really silly thing: [url]http://engineeringnotes.net/personal/[/url] Does anyone know why the text is hanging off the left side of the page (on the "home" page and the "publications" page? Thanks, Dave

Member Avatar for daviddoria
0
175
Member Avatar for atch

Please post the smallest compilable example of your problem. "I'm getting errors" doesn't really let us know what is going on. My guess is you need to put "typename" in front of your nested qualifier: [code] typename namespaceOne::namespaceTwo::YourClass A; //instead of //namespaceOne::namespaceTwo::YourClass A; [/code] The later is ambiguous - the …

Member Avatar for atch
0
86
Member Avatar for Rofljosh

Please show us the code that you've come up with so far and we can help guide you.

Member Avatar for Rofljosh
0
916
Member Avatar for daviddoria

When debugging my code, I put a break point at this line: [code] std::set<unsigned int>::iterator it; [/code] When I step over that line, I get "Debugger reported the following error: cannot access memory at address 0x10". I am using KDevelop that ships with Fedora 11. I've used that line of …

Member Avatar for Nick Evan
0
3K
Member Avatar for gerbanzo129

Please use code tags. Also, what is the current (incorrect) output? Also, you don't seem to show where seller, cost etc are defined and given values?

Member Avatar for necrolin
0
93
Member Avatar for daviddoria

I have a function like this: [code] bool MyFunction(dist) { if(dist < 1.2) { std::cout << "Passed test!" << std::endl; return true; } else { std::cout << "Failed test!" << std::endl; return false; } std::cout << std::endl; } [/code] gcc tells me "warning- control reaches end of non-void function". However, …

Member Avatar for StuXYZ
0
276

The End.