Код: Выделить всё
head.hppКод: Выделить всё
#ifndef HEAD_HPP
#define HEAD_HPP
auto f();
#endif
< /code>
head.cppКод: Выделить всё
#include "head.hpp"
auto f(){
return [](){
return 10;
};
}
< /code>
test1.cppКод: Выделить всё
#include "head.hpp"
int foo(){
auto func = f();
return f();
}
< /code>
main.cpp#include "head.hpp"
int foo();
int main(){
auto fu = f();
return fu() + 5 + foo();
}
< /code>
All files are compiled together
I still get the error:
error: use of ‘auto f()’ before deduction of ‘auto’
auto fu = f();
Подробнее здесь: https://stackoverflow.com/questions/595 ... ultiple-cp
Мобильная версия