User forums > Using Code::Blocks

User template and output filename

(1/2) > >>

Baz:
Hello all,
I want the output filename to be the name of the project. I'm using a custom template and have added

--- Code: ---<Option output="bin\Release\$(PROJECT_NAME).exe" />
in the template. Unfortunately, the $(PROJECT_NAME) variable picks up the name used in the template itself and not the name of the project.
any ideas?
Many thanks.
--- End code ---

Baz:
Sorry about the bad layout in my post, but I can't edit it.

fili:
I think that this is a bug in the nightly builds. At home I'm using RC2 and $(PROJECT_NAME) works as intended. At work I'm using the 20-may build and $(PROJECT_NAME) gets replaced by the project name as it was when the template was saved.

thomas:
console.cbp:
<?xml version="1.0"?>
<!DOCTYPE CodeBlocks_project_file>
<CodeBlocks_project_file>
   <FileVersion major="1" minor="1"/>
   <Project>
      <Option title="Console application"/>
      <Option makefile="Makefile"/>
      <Build>
         <Target title="default">
            <Option type="1"/>
            <Option parameters=""/>
            <Option includeInTargetAll="1"/>
            <Option projectCompilerOptionsRelation="3"/>
            <Option projectLinkerOptionsRelation="3"/>
            <Option projectIncludeDirsRelation="3"/>
            <Option projectLibDirsRelation="3"/>
            <Option output="bin\Release\$(PROJECT_NAME).exe" />
            <Compiler>
               <Add option=""/>
            </Compiler>
            <Linker>
               <Add option=""/>
            </Linker>
         </Target>
      </Build>
   </Project>
</CodeBlocks_project_file>

Result:



And the problem is...?

Baz:
@Thomas
Clearly no problem at all for you, but for me, the name of the template is used as the .exe file name.

Let's say my template has "<Option title="Monkey/>" If I create a project from the user template (Monkey) and rename the project at the rename dialog to "Tiger", when I compile the project I get Monkey.exe and not Tiger.exe. Incidently, if the template title has a space in it like in your example, then I get a link error. For example, if my template is called Win32 Application, then when I complile the project I will get a link error along the lines of "Error loading Application.exe".

I know this isn't happening in your example, but it really is happening to me, honest, I'm not making it up.

Many thanks.

Navigation

[0] Message Index

[#] Next page

Go to full version