Reputation: 7468
I have following code:
#include <iostream>
using namespace std;
int main()
{
addition(....);
}
constexpr static uint64_t addition (int a, int b) {
.....
}
I get error as:
error: ‘addition’ was not declared in this scope
What is wrong here?
Upvotes: 0
Views: 60
Reputation: 5331
You try this:
#include <iostream>
using namespace std;
// function declaration
constexpr static uint64_t addition (int a, int b);
int main()
{
addition(....);
}
constexpr static uint64_t addition (int a, int b) {
.....
}
You need to declare the method before main()
or you can define the complete method before main()
.
Upvotes: 3