954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

error c2296: '/': "left hand"; :c2297: "right hand" illegal....

Morning all.
Hope everyone has great weekend.
Once I get done posting this I'll be digging yet another hole for my spinkler system, and hopefully finishing off my drip system for more backyard.
Ok....
Onto my issue.
After a week of struggle to find out why I kept getting errors, I've finally reduced them to a single error-- 5 times.

------ Build started: Project: AngleFinder, Configuration: Debug Win32 ------
Compiling...
SteveAngle.cpp
.\SteveAngle.cpp(85) : error C2296: '/' : illegal, left operand has type 'long double (__cdecl *)(const float)'
.\SteveAngle.cpp(88) : error C2297: '/' : illegal, right operand has type 'long double (__cdecl *)(const float)'
.\SteveAngle.cpp(119) : error C2296: '/' : illegal, left operand has type 'long double (__cdecl *)(const float)'
.\SteveAngle.cpp(122) : error C2297: '/' : illegal, right operand has type 'long double (__cdecl *)(const float)'
.\SteveAngle.cpp(151) : error C2297: '/' : illegal, right operand has type 'long double (__cdecl *)(const float)'
Build log was saved at "file://e:\Steve'sDocs\Visual Studio 2008\Projects\AngleFinder\AngleFinder\Debug\BuildLog.htm"
AngleFinder - 5 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Here are my # include headers.

# include <stdafx.h>
# include <iostream>
# include <cmath>
# include <xutility>
# include <conio.h>
using std::cout;
using std::cin;
using std::endl;


What I don't understand is why does not recognize the use of the divisor symbol for division.
And I further don't undrstand how I'm to get division operations when this happens.
I have in fact done a search on this forum, and on google, and no one is discussing this. The only c2297 errors being discussed are for the modulus operator.
Which tells me that no one has had this particular problem before (or if they have, they apparently were able to resolve it without the need to post)-- leading me to the question-- why am I having it.
I'm doing 4 distinct operations with the division symbol, and it's calling all four-- three are identical.

Oh, on another note, why do I need to define PI? I thought PI was also located in the constant library of .
What would I need to include for the math constants?
Thank you for your respective helps-- they are deeply appreciated.

SteveDB
Newbie Poster
24 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

------ Build started: Project: AngleFinder, Configuration: Debug Win32 ------
Compiling...
SteveAngle.cpp
.\SteveAngle.cpp(85) : error C2296: '/' : illegal, left operand has type 'long double (__cdecl *)(const float)'
.\SteveAngle.cpp(88) : error C2297: '/' : illegal, right operand has type 'long double (__cdecl *)(const float)'
.\SteveAngle.cpp(119) : error C2296: '/' : illegal, left operand has type 'long double (__cdecl *)(const float)'
.\SteveAngle.cpp(122) : error C2297: '/' : illegal, right operand has type 'long double (__cdecl *)(const float)'
.\SteveAngle.cpp(151) : error C2297: '/' : illegal, right operand has type 'long double (__cdecl *)(const float)'
Build log was saved at "file://e:\Steve'sDocs\Visual Studio 2008\Projects\AngleFinder\AngleFinder\Debug\BuildLog.htm"
AngleFinder - 5 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Are you trying to divide using a divide char?

Or are you trying to divide by a floating-point value?

Alex Edwards
Posting Shark
972 posts since Jun 2008
Reputation Points: 392
Solved Threads: 109
 

Sorry,
I thought I'd given an example of my two of my division function. In fact I know I did... I wonder why they didn't post.
Just the basic / symbol.

float a;
a = PI / 180;
float x;
x = 180 / PI;
float b;
b = (atan((float)(...)/(...)) * x);


I then have two other functions that are far too complicated to write out here, but they too are using the / symbol.

acos(....(....) / (sqrt(....)+sqrt(.....)))


where the ellipses are the contents of those functions.

SteveDB
Newbie Poster
24 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You