fx call prototype errors

Errors below. How do I call this function below separated .cpp/.h ?

main
1
2
3
4
{
...
set_intrinsics(cam_intrinsic);
}

.cpp
1
2
...
void set_intrinsics(cv::Mat &cam_intrinsic);

.h
 
void set_intrinsics(Mat &cam_intrinsic);

Result:

term does not evaluate to a function taking 1 arguments
'set_intrinsics': illegal use of type 'void'
Where do you define (implement) the set_intrinsics function?
Also, you use cv::Mat in your .cpp but Mat in your header. Seems a bit odd. Usually you should avoid using "using" statements in the header file.
Where does the error come from?

You list "main" and ".cpp". To us it implies that you have two source files. One .cpp that contains the main() function and another .cpp that you refer to as ".cpp". These two files will be compiled separately. As two "translation units". (The resulting object files are linked into executable.)

Which of the two gives the error? Do they both include the header file?
What else is there?


Both of these are function declarations:
1
2
void set_intrinsics( cv::Mat &cam_intrinsic ) ;
void set_intrinsics( Mat &cam_intrinsic ) ;

Whether they declare the same function depends on whether cv::Mat and Mat are same typename.

Function's implementation has body, not semicolon:
1
2
3
void set_intrinsics( cv::Mat &cam_intrinsic ) {
  // implementation
}



Finally, your main() apparently has variable with name 'cam_intrinsic'.
While it is probably logical and convenient to reuse the name for name of parameter, it could distract thinking. Remember that a function can be called in more than one occasion:
1
2
3
set_intrinsics( cam_intrinsic );
set_intrinsics( snafu );
set_intrinsics( bar );
You list "main" and ".cpp". To us it implies that you have two source files. One .cpp that contains the main() function and another .cpp that you refer to as ".cpp".


Yes.

main() apparently has variable with name 'cam_intrinsic'.

Confused here. Sorry. I defined my cam_intrinsic as a matrix with Mat cam_intrinsic(3, 3, CV_64FC1) earlier in the main program. So to make that relationship more explicit for right now I have put it over the set_intrinsics function as a sanity check.

Result was elimination of said errors leaving one:

1
2
3

'cam_intrinsic': undeclared identifier	


So something I am doing is creating two different functions when I think they are seen the same by the compiler?
Last edited on
Show your full set_intrinsics function.

Show your full set_intrinsics function.


setIntrinsics.h:
 
void set_intrinsics(Mat &cam_intrinsic);


setIntrinsics.cpp
1
2
3
4
5
6
void set_intrinsics(Mat &cam_intrinsic)
{
CV_FX = 543.2551738375544,
cam_intrinsic.at<double>(0, 0) = CV_FX;
...similar code
}

main.cpp
1
2
Mat cam_intrinsic(3, 3, CV_64FC1);
set_intrinsics(cam_intrinsic);


Last edited on
Which line gives the error message?

Do you really have comma?
1
2
3
4
5
void set_intrinsics(Mat &cam_intrinsic)
{
  CV_FX = 543.2551738375544, cam_intrinsic.at<double>(0, 0) = CV_FX;
  // ...similar code
}
Last edited on
Also useful to provide: http://www.sscce.org/
Registered users can post here. Sign in or register to post.