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

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Jun 2008
Posts: 24
Reputation: SteveDB is an unknown quantity at this point 
Solved Threads: 0
SteveDB SteveDB is offline Offline
Newbie Poster

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

 
0
  #1
Jun 21st, 2008
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.

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

Here are my # include headers.

  1. # include <stdafx.h>
  2. # include <iostream>
  3. # include <cmath>
  4. # include <xutility>
  5. # include <conio.h>
  6. using std::cout;
  7. using std::cin;
  8. using std::endl;

What I don't understand is why <cmath> 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 <cmath>.
What would I need to include for the math constants?
Thank you for your respective helps-- they are deeply appreciated.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 973
Reputation: Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough 
Solved Threads: 107
Alex Edwards's Avatar
Alex Edwards Alex Edwards is offline Offline
Posting Shark

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

 
0
  #2
Jun 21st, 2008
------ 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?
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 24
Reputation: SteveDB is an unknown quantity at this point 
Solved Threads: 0
SteveDB SteveDB is offline Offline
Newbie Poster

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

 
0
  #3
Jun 21st, 2008
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.
  1. float a;
  2. a = PI / 180;
  3. float x;
  4. x = 180 / PI;
  5. float b;
  6. 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.
  1. acos(....(....) / (sqrt(....)+sqrt(.....)))
where the ellipses are the contents of those functions.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC