C/C++ C++ Error: Underscores in Function Names

  • Thread starter Thread starter ehrenfest
  • Start date Start date
  • Tags Tags
    C++ Function
AI Thread Summary
The discussion centers around a compilation error in C++ related to the function name "angle_between," which cannot be used as a function. The user resolved the issue by renaming the function to "function1," suggesting that underscores in function names should not inherently cause problems, except for leading or trailing underscores. Participants recommend checking for typos related to "angle_between" and suggest posting the specific line of code causing the error for further assistance. Additionally, they advise searching the codebase for any prior definitions of "angle_between" that might conflict with its intended use.
ehrenfest
Messages
2,001
Reaction score
1
I got the following error when I tried to compile some code:

Code:
error: `angle_between' cannot be used as a function

I changed the function name to "function1" and it compiled. Since when did C++ not like underscores in function names?
 
Technology news on Phys.org
The underscore isn't a problem ( although leading and trailing ones can cause issues)
Are you sure you haven't got a angle_between() typo somewhere ?

Can you post the line the compiler complains about?
 
Yeah, it "looks" fine. Maybe you should post the code and where the compiler cries.
 
Grep your sources looking for angle_between, could be it was defined earlier as something else.
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.

Similar threads

Back
Top