This question already has an answer here:
- Undefined symbols for constexpr function 3 answers
Say I have the following files. Is this invalid C++ (linker chokes, so yeah) or is it a mistake in my syntax? Must a forward declaration of a constexpr function be in the same file as its definition?
header.h
extern constexpr int fun(int);
source.cpp
constexpr int fun(int x)
{
return x * 2;
}
Aucun commentaire:
Enregistrer un commentaire