User forums > General (but related to Code::Blocks)

TPP file type and codeblocks application closing error.

<< < (2/3) > >>

oBFusCATed:
Can you try if adding the tpp file extension to the list of source extensions in "Project -> Project tree -> Edit file types and categories" fixes your problems?
If not then we'll probably have to edit the source of C::B.

p.s. I can't judge people, but it is a bit annoying that there are 5-10 different extensions for the same thing (cpp, C, cxx, c++, cc, tpp, etc). I see very little benefit using something different than cpp.

scarphin:
@12345:
For syntax highlighting add .tpp to 'settings->editor->syntax highlighting->choose c/c++->filemasks'.

For code completion (be aware that the code completion's template coverage is very limited) add .tpp to 'settings->editor->code completion->c/c++ parser (adv.) tab->file extensions to parse as header/source files'. Whichever suits best but I think it's a source file.

To make cb compile your file automatically you can try making a custom extension entry. Go to 'settings->compiler->select your compiler->other settings (the rightmost tab)->advanced options->commands tab', add a .tpp extension (the button with the plus sign '+') and copy the entries under the empty extension and/or modify them to suit your needs. As obfuscated said previously, cb's source must be modified to get rid of this procedure as the default source file extensions cb compiles automatically are hardcoded.

12345:
I'd like someone to modify codeblocks's sources and so making it able to do this without changes in codeblocks settings. I heard that this files with this extension can replace putting templates implementation in header files, without the restriction of creating a cpp file for implementation and a hpp file for declaration of a template.
P.S.: The restriction causes undefined references to template types not declared in cpp and hpp files.

scarphin:
I'm quite sure that your statement is incorrect because the compiler will give you hell if the declaration and implementation of a c++ template are in separate files, exactly the opposite of what you say. Although it's possible to separate the declaration and implementation of a c++ template (not with the restriction of using a .tpp), I've never seen any code using anything other than a simple '.hpp' file for both the declaration and implementation. The .hpp extension is only a notification for the programmer that the file itself contains a template and not restricted by the compiler in any way other than the file itself has to be a valid c++ file, that means changing the file extension from .hpp to .cpp, .h, .hpp etc... won't make any difference. In case I misunderstood your comments and if you have your template's declaration and implementation in a single file then just change the extension to '.hpp' and it will work out of the box. Otherwise my previous post should work for you as much as it could get with cb.

12345:
I said that separating implementation and declaration causes many compiler errors. I also said that these problems could be solved putting implementation in a tpp file. But I only heard that. When I tried to do this I wasn't able to compile these files. And I am still, I did what you said, but codeblocks still can't compile them. I also said that when I close an application, sometimes codeblocks thinks it's still running and so doesn't let me compile anything. Also abort button doesn't work in this case.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version