Author Topic: TPP file type and codeblocks application closing error.  (Read 3529 times)

Offline 12345

  • Single posting newcomer
  • *
  • Posts: 8
TPP file type and codeblocks application closing error.
« on: November 08, 2015, 03:57:45 pm »
Sorry for my English. I'd like codeblocks to support tpp file type, that are source files containing templates implementations. I also found a bug in codeblocks: if I minimize codeblocks and then I close the application it was running, codeblocks thinks it is still running and doesn't let me build and run another application until I close codeblocks. I'm using windows 8.1 64 bit running on intel core i3 3120M with 4 gb of ram, 500 gb HD 5400 rpm and amd radeon hd 7670m as gpu. Codeblocks is 32 bit and is not a nightly build.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11489
    • Travis build status
Re: TPP file type and codeblocks application closing error.
« Reply #1 on: November 08, 2015, 05:19:52 pm »
What do you mean by support tpp files?
What kind of app do you make (gui, console, other)?
Can the closing bug be reproduce with a console app?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline 12345

  • Single posting newcomer
  • *
  • Posts: 8
Re: TPP file type and codeblocks application closing error.
« Reply #2 on: November 09, 2015, 04:38:14 pm »
For tpp files I mean files with extension .tpp and which, as explained before, contain templates implementations.
The bug is produced both with a console application and with a gui application, but it doesn't happen always.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11489
    • Travis build status
Re: TPP file type and codeblocks application closing error.
« Reply #3 on: November 09, 2015, 08:04:24 pm »
What do you need to be supported? Syntax highlight? Building them as part of the project? Something else?
Support is to generic term, so you have to explain your problem a bit better!
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline 12345

  • Single posting newcomer
  • *
  • Posts: 8
Re: TPP file type and codeblocks application closing error.
« Reply #4 on: November 09, 2015, 08:56:12 pm »
Codeblocks can't build those files, so I'd like it to be able to build them. Syntax hightlight and putting them in sources tree can be done by user, but I'd prefer codeblocks does it by default.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11489
    • Travis build status
Re: TPP file type and codeblocks application closing error.
« Reply #5 on: November 09, 2015, 09:37:03 pm »
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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: TPP file type and codeblocks application closing error.
« Reply #6 on: November 10, 2015, 12:37:59 am »
@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.

Offline 12345

  • Single posting newcomer
  • *
  • Posts: 8
Re: TPP file type and codeblocks application closing error.
« Reply #7 on: November 11, 2015, 06:43:00 pm »
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.

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: TPP file type and codeblocks application closing error.
« Reply #8 on: November 11, 2015, 07:35:10 pm »
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.

Offline 12345

  • Single posting newcomer
  • *
  • Posts: 8
Re: TPP file type and codeblocks application closing error.
« Reply #9 on: November 13, 2015, 03:47:03 pm »
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.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6434
    • My Best Post
Re: TPP file type and codeblocks application closing error.
« Reply #10 on: November 13, 2015, 04:03:30 pm »
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.

Did you check to make sure your program is NOT still running?
On Windows, you can use the task manager to check this out.

Edit: For the tpp file issue; I suggest posting on a site that supports your compiler before any more time and effort is wasted on the idea on this site. Code::Blocks is NOT a compiler in case you did NOT know that.

Edit2: If I recall correctly, normally the tpp file is just included by the hpp file and the compiler or IDE does NOT have to anything special to use the tpp file.

Tim S.
« Last Edit: November 13, 2015, 04:13:50 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11489
    • Travis build status
Re: TPP file type and codeblocks application closing error.
« Reply #11 on: November 13, 2015, 08:36:39 pm »
One easy way to see if the tpp issue is a cb problem or not is to rename the file to *.cpp and see if it solves your problem.
But if you're putting implementations of templates in this file then it won't solve the problem.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: TPP file type and codeblocks application closing error.
« Reply #12 on: November 13, 2015, 11:11:10 pm »
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.
Ok, I understand that you are trying to separate your declaration and implementation of your template. First of all this is a very bad programming practice unless you have a very good reason (and/or obligation) to do so. Second and more important, renaming your file's extension to .tpp will make absolutely no difference in terms of compiler (at least for gcc). So take obfuscated's advice and rename your .tpp files to .cpp and try building your project/template. If it does not build, I can assure you that it still won't with the same compiler options/switches even if cb compiled them automatically.

Offline 12345

  • Single posting newcomer
  • *
  • Posts: 8
Re: TPP file type and codeblocks application closing error.
« Reply #13 on: November 14, 2015, 05:35:20 pm »
I understand. I'll put implementation in hpp file. In the first post I dealt with a codeblocks error. I find out when it occurs. If you want, you can try yourself. You run a console application, then you click on abort button to close cb_console_runner. The application will be closed, but codeblocks still thinks it's running. I used task manager and the application is still running in background. Is possible modify codeblocks source and so avoid it?
« Last Edit: November 21, 2015, 03:02:40 pm by 12345 »