Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: realmeat on May 16, 2006, 10:44:10 am

Title: how to design the template
Post by: realmeat on May 16, 2006, 10:44:10 am
I want to design a template for work

Have any document ?

thx a lot.

Title: Re: how to make the template
Post by: Michael on May 16, 2006, 10:45:58 am
Hello,

Did you try to search in the forum?

I am quite sure that you will find your answer after a small search :).

Best wishes,
Michael
Title: Re: how to design the template
Post by: realmeat on May 17, 2006, 03:57:54 am
This is FLTK template file code

Xml
------------------------------------------------
<?xml version="1.0"?>
<!DOCTYPE CodeBlocks_template_file>
<CodeBlocks_template_file>
      <Template name="FLTK" title="FLTK Application" category="GUI" bitmap="fltk.png">
      <Notice value="This template expects FLTK to be located at C:\fltk-1.1.6.
                  If this is not the case, you will have to update the relevant
                  custom variable accordingly.

                  To do this, click on &quot;Project->Build options->Custom variables&quot;"
            isWarning="1"/>
      <FileSet name="s" title="Default">
         <File source="fltk-main.cpp" destination="main.cpp"/>
      </FileSet>
      <Option name="FLTK Application">
         <Project file="fltk.cbp"/>
      </Option>
   </Template>
</CodeBlocks_template_file>
-------------------------------------------------------------------------
In this template, i know how to do FileSet and Project Name
but how about the project linking to lib?
If I have a special lib,how shall I do?
Otherwise, I must set the linking before using the template
Title: Re: how to design the template
Post by: realmeat on May 17, 2006, 07:25:09 am
I find out the point.
In *.cbp

<Linker>
  <Add library = "lib path"/>
</Linker>

but, I have more one question.

have any variables which define the path of codeblocks dir ?
Just like $(FLTK_DIR) ,$(#WX.lib) defined some path.

Title: Re: how to design the template
Post by: sethjackson on May 17, 2006, 01:39:57 pm
Yes.

http://wiki.codeblocks.org/index.php?title=Builtin_variables

$(CODEBLOCKS) $(APP_PATH) $(APPPATH) $(APP-PATH)
Title: Re: how to design the template
Post by: realmeat on May 18, 2006, 05:03:53 am
thank you very much!! :D

but I have some problem in using the variable.

If I want to set the directory by using $(CODEBLOCKS )to C:\program files\CODEBLOCKS\personal_include,

(my code::blocks program dirctory is C:\program files\CODEBLOCKS)

I set the follow :(Build Options->Directorys->compiler)

    $(CODEBLOCKS)\personal_include

after the building , the compiler tell me it can't find directory / file.

   $(CODEBLOCKS)  ==  "C:\program files\CODEBLOCKS"   ??

I'm confused... :?

--
By the way,

(Build Options->Custom variables)
I set the Variable $(CODE) = "c:\program files\CODEBLOCKS"

and change the path to the follow:
$(CODE)\personal_include

No error.
Title: Re: how to design the template
Post by: realmeat on May 18, 2006, 08:08:58 am
I solve this problem.

Maybe that's a bug.

$(CODEBLOCKS)  == "c:\program files\codeblocks";

but in compiling, $(CODEBLOCKS) becomes "c:\program" and "file\codeblocks",two variables.

so, it search "c:\program" and "files\codeblocks\personal_include\"

It's so ridiculous.....

But I use other way to slove this.

in the custom variable

<Environment>
    <Variable name="PATH" value='&quot;$(CODEBLOCKS)&quot;' />
</Environment>

and... 
   $(PATH)\personal_include

use another variable replace the default.

Maybe that's all fault because of WIN system.
Title: Re: how to design the template
Post by: thomas on May 18, 2006, 08:46:32 am
This is a bug that has been fixed many months ago, so you must be using quite an old version (probably RC2).
If you were using a more recent version, you would want to use the $(#cb.include) global user variable for that purpose, too. That will do the same thing, but won't require you to set the path again and again with every project.