|
| pmasterkim (2) | |||||
| Dear C++ users, My name is Kim, and I am fairly new to C++ programing. I have worked with it, but I have little knowledge of the language itself. I recently tried to compile this and end up with an error that follows
Could someone please highlight the error involved. My initial thoughts is that either RFSensor or RFPulse is not defined as a class. The following is the header for RFSensor.
Am I right that I need to define RFPulse? Or is there more errors that I've yet to pick up on. Thank you in advance, Kim | |||||
| gcampton (100) | |
| yes in headers it is best practice to define params, otherwise clients/other programmers using the header has no idea what some_function(int,int,string,string,double,char) means.... Usually the variable name gives a bit more meaning to it. as for why this error is occurring I cannot elaborate unfortunately. | |
| jsmith (3099) | |
| The code you pasted above looks fine. You've forward declared RFPulse because the header does not need to know anything about the type (at least the part that you pasted), so I would agree with the forward declaration. Just looking at your error messages, I think you have one, maybe two problems. First, In RFSensor.cxx you are going to need to #include the header file that actually declares RFPulse. You haven't done that, so the only declaration the compiler sees while compiling RFSensor.cxx is the incomplete (forward) declaration in RFSensor.h. Second, because testTrigger takes an RFPulse by non-const reference, you cannot pass a temporary RFPulse instance to that function. I don't think you are doing that, because if you were, I'd expect you to get an error message about binding temporaries to non-const references. However, depending upon your compiler, I could see getting the error message you are getting (lines 3-4)... if you were passing a temporary, the compiler would want to match a function that took an RFPulse by value to compile. If you are unable to fix all the compile errors, you'll have to post the part of the .cxx file that is causing the compile errors. | |
| pmasterkim (2) | ||||||
Firstly thank you to you two for replying and identifying the cause, I've included the RFPulse.h in the RFSensor.cxx. It now points to a new error of which I have no understanding
the source for RFPulse.h is
Where line 22 has the fRelPos. I am unsure of what the error means, can someone inform me of the cause? Thank you If it is needed this is the source for RFSensor.cxx
| ||||||
Registered users can post in this forum.
