-4

I am creating a C++ program that makes use of templates, but when I try to build my project my CLI returns this error.

C:\...\bin>g++ ../src/main.cpp ../src/lib/* -o main
../src/lib/Row.tpp: file not recognized: file format not recognized
collect2.exe: error: ld returned 1 exit status

Are any general issues that may cause this?

Jason
  • 36,170
  • 5
  • 26
  • 60
  • If you can read the warning message: `file not recognized: file format not recognized`, you can get the answer. We only have `.cpp` for C++. – Sean Sep 21 '22 at 07:13

1 Answers1

3

g++ applies an heuristic based on the extension to know what to do with given files: compile it (and with which compiler C, C++, Ada, ...), pass it to the linker, ... The default is passing it to the linker. .tpp is not a recognized extension and thus ../src/lib/Row.tpp is passed to the linker which does not recognize the file format.

The root cause is probably the subject of this question.

AProgrammer
  • 51,233
  • 8
  • 91
  • 143