c++ - "C4430: missing type specifier - int assumed" in a template function -


this code simple, shouldnt compile? lost one.

#include <iostream>  template<typename t> foo(t f) {     std::cout << f << std::endl; }  int main() {     foo(3);      return 0; } 

error:

main.cpp(6): error c4430: missing type specifier - int assumed. note: c++ not support default-int 

you're missing return type foo. presumably, want:

                     vvvv template<typename t> void foo(t f) {                    ^^^^     std::cout << f << std::endl; } 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -