| | |
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:
Solved Threads: 0
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.
Here are my # include headers.
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.
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.
C++ Syntax (Toggle Plain Text)
------ 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.
C++ Syntax (Toggle Plain Text)
# 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 <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.
------ 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?
•
•
Join Date: Jun 2008
Posts: 24
Reputation:
Solved Threads: 0
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.
I then have two other functions that are far too complicated to write out here, but they too are using the / symbol.
where the ellipses are the contents of those functions.
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.
C++ Syntax (Toggle Plain Text)
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.
C++ Syntax (Toggle Plain Text)
acos(....(....) / (sqrt(....)+sqrt(.....)))
![]() |
Other Threads in the C++ Forum
- Previous Thread: Template conversion
- Next Thread: Object creation within a if{ bracket
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count data database delete deploy developer dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game getline givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int java lib linker list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings temperature template test text text-file tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets





