User forums > Using Code::Blocks

How to add a special purpose compiler?

(1/2) > >>

cacb:
Hi,

I have been looking at Tntnet at tntnet.org (website down at the moment of writing). It has a way of creating web applications using C++, which I find interesting. Even more interesting is that you can create "stand alone" web applications that contain their own web server, it is simply a special form of C++ console application. That means it is possible to use Code::Blocks for such web development.  Tntnet has a special file type *.ecpp which compiles into *.cpp using the ecpp compiler:


--- Code: ---ecppc <filename>.ecpp  -o <filename>.cpp
--- End code ---

Obviously, the output *.cpp file is further compiled using the C++ compiler in the normal way. One may do this using makefiles, however, I would much prefer to use the Code::Blocks build system instead.

My question is therefore: What do I need to do in Code::Blocks to make it recognize *.ecpp files. compile them using the ecppc compiler and immediately compile/link the resulting *.cpp file using g++?

oBFusCATed:
Have you read this: http://wiki.codeblocks.org/index.php?title=Adding_support_for_non_C/C%2B%2B_files_to_the_build_system

ouch:
Well go to settings->environment and then file extension handling and add *.ecpp
Then for the project itself, use the Pre-build section on Pre/Post build step tab to run the command to convert the .ecpp files to .cpp. This is in "project build settings".
From there whatever compiler your using should work fine as long as you remember to add any new cpp files that you create to the project.

Or you can use the advanced options in the compiler settings to add proper seamless support like oBFusCATed suggested.

cacb:

--- Quote from: oBFusCATed on December 30, 2013, 09:59:14 pm ---Have you read this: http://wiki.codeblocks.org/index.php?title=Adding_support_for_non_C/C%2B%2B_files_to_the_build_system

--- End quote ---

Thanks a lot! I searched around quite a bit, but obviously didn't choose the right search words!

I ended up doing this, which seems to work perfectly


Notice that the dialog has a confusing description of macros, for example $file_dir is presented as $filedir, that had me fooled for a while. The Windows version of the same dialog is even more deceptive, as no underscores are shown at all. I would not have figured that out without the examples in the link you provided.

The correct path to this configuration dialog  now appears to be
Settings->Compiler->Other settings.  Look for "Advanced options" in lower right, it's easy to miss.

I did a couple of test runs with ecpp files and it really works beautifully in Code::Blocks.

stahta01:

--- Quote from: cacb on December 30, 2013, 11:16:04 pm ---
--- Quote from: oBFusCATed on December 30, 2013, 09:59:14 pm ---Have you read this: http://wiki.codeblocks.org/index.php?title=Adding_support_for_non_C/C%2B%2B_files_to_the_build_system

--- End quote ---

Thanks a lot! I searched around quite a bit, but obviously didn't choose the right search words!

I ended up doing this, which seems to work perfectly


Notice that the dialog has a confusing description of macros, for example $file_dir is presented as $filedir, that had me fooled for a while. The Windows version of the same dialog is even more deceptive, as no underscores are shown at all. I would not have figured that out without the examples in the link you provided.

The correct path to this configuration dialog  now appears to be
Settings->Compiler->Other settings.  Look for "Advanced options" in lower right, it's easy to miss.

I did a couple of test runs with ecpp files and it really works beautifully in Code::Blocks.

--- End quote ---

Please report the CB version and OS info and maybe a CB Dev will look into the display issue.

Note: I confirm the lack of Underscores in Windows 7 using CB 13.12.

Edit: I am guessing that advanced_compiler_options.xrc is the cause of the issue.


Tim S.

Navigation

[0] Message Index

[#] Next page

Go to full version