NO

Author Topic: how to rename an output file ?  (Read 7077 times)

tiwag

  • Guest
how to rename an output file ?
« on: April 09, 2005, 11:22:01 PM »
How can i change the directory and/or the name of
an the output file in an existing project ?

example:

my project is a Win32 dll,

the output file is "C:\project_dir\output\sample.dll"

i want to change the output file to
"D:\herenow\function2.dll"

i couldnt figure out how to do that in PellesC

thanks a lot,
bye tiwag

Anonymous

  • Guest
Re: how to rename an output file ?
« Reply #1 on: April 09, 2005, 11:38:15 PM »
Quote from: "tiwag"
How can i change the directory and/or the name of
an the output file in an existing project ?


There might be an easier way to do it, but I've been editing the PPJ file for the project in Notepad.  (Exit POIDE first, or it will overwrite your changes when you close it down.)

One feature Pelle might consider for the next version is the ability to rename files and change project paths in the project manager.  

This is one of my project files...  The output filename is at the top of the first block after the SILENT keyword...   Project paths and such can be changed in the first group of parameters.

Code: [Select]

#
# PROJECT FILE generated by "Pelles C for Windows, version 3.00".
# NOTE! Manual changes of this file is done at your own risk.
#

POC_PROJECT_VERSION = 1.00#
POC_PROJECT_TYPE = 0#
POC_PROJECT_PATH = .#
POC_PROJECT_ARGUMENTS = #
POC_PROJECT_WORKPATH = #
POC_PROJECT_EXECUTOR = #
CC = pocc.exe#
AS = ml.exe#
RC = porc.exe#
LINK = polink.exe#
CCFLAGS =  -Tx86-coff -Os -Ox -W1 -Gz -Ze -Zx #
ASFLAGS =  -W1 -Cu -c -nologo -coff#
RCFLAGS =  -L0x1009 #
LINKFLAGS =  -subsystem:windows -machine:ix86  kernel32.lib user32.lib gdi32.lib comctl32.lib advapi32.lib#

.SILENT:  
 

#
# Build scan.exe.
#
"$(POC_PROJECT_PATH)\scan.exe": \                   <---- output filename
  "$(POC_PROJECT_PATH)\output\fsmain.obj" \
  "$(POC_PROJECT_PATH)\output\fscan.res"  
  $(LINK) $(LINKFLAGS) -out:"$@" $**

#
# Build fsmain.obj.
#
"$(POC_PROJECT_PATH)\output\fsmain.obj": \
  "$(POC_PROJECT_PATH)\fsmain.c"  
  $(CC) $(CCFLAGS) "$!" -Fo"$@"

#
# Build fscan.res.
#
"$(POC_PROJECT_PATH)\output\fscan.res": \
  "$(POC_PROJECT_PATH)\fscan.rc" \
  "$(POC_PROJECT_PATH)\scan.ico"  
  $(RC) $(RCFLAGS) "$!" -Fo"$@"


Oh, and the warning about manual changes should be taken to heart.  I've crashed more than one project fooling around inside this file.

tiwag

  • Guest
Re: how to rename an output file ?
« Reply #2 on: April 10, 2005, 12:12:34 AM »
Thanks ldblake, but i'm looking for the

Quote from: "ldblake"
... easier way to do it ...


because of

Quote from: "ldblake"

Oh, and the warning about manual changes should be taken to heart.  I've crashed more than one project fooling around inside this file.


which i experienced also a few times ;-((

bye, tiwag

Anonymous

  • Guest
Re: how to rename an output file ?
« Reply #3 on: April 10, 2005, 05:25:09 AM »
Quote from: "tiwag"
Thanks ldblake, but i'm looking for the

Quote from: "ldblake"
... easier way to do it ...


because of

Quote from: "ldblake"

Oh, and the warning about manual changes should be taken to heart.  I've crashed more than one project fooling around inside this file.


which i experienced also a few times ;-((

bye, tiwag


I'm not sure there actually is an easier way... the new project wizard seems quite intent on creating directories and naming the output file on a once and for all basis.  This is probably fine most of the time, but on occasion I've needed to rename a file and about the only way I've found that doesn't begin with obliterating the project files and rebuilding them is to take the risk of a manual edit.

Perhaps Pelle will shed some light...

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
how to rename an output file ?
« Reply #4 on: April 10, 2005, 11:47:34 AM »
For the rather few occasions when you want the output file in a specific directory (for testing), adding a copy command is the simplest:

1. Choose Target files view in the project window.
2. Right-click on the output file and select Properties from the context menu.
3. Add the command to the Build commands tab, on a new line.

It usually looks something like this...
Code: [Select]

$(LINK) $(LINKFLAGS) -out:"$@" $**


...change to something like this...
Code: [Select]

$(LINK) $(LINKFLAGS) -out:"$@" $**
copy xyz.dll d:\my\fine\dir\xyz.mup


Pelle
/Pelle

tiwag

  • Guest
how to rename an output file ?
« Reply #5 on: April 10, 2005, 12:18:41 PM »
copying the file is not sufficient in the case, when you want to debug your dll, when the program which uses the dll wants it in a specific directory.
This is my application and i need the dll created in a completely different directory than the projects directory.

so editing the ppj file is obviously the only way for that.
i have only changed the line with the dll to the correct path

from V1
Code: [Select]
#
# Build userdll.dll.
#
"$(POC_PROJECT_PATH)\userdll.dll": \
  "$(POC_PROJECT_PATH)\output\trnspose.obj" \
  "$(POC_PROJECT_PATH)\output\userdll.obj" \
  "$(POC_PROJECT_PATH)\output\realsum.obj" \
  "$(POC_PROJECT_PATH)\output\string.obj"  
  $(LINK) $(LINKFLAGS) -out:"$@" $**


to V2
Code: [Select]
#
# Build userdll.dll.
#
"D:\Programme\Mathsoft\Mathcad11\UserEFI\userdll.dll": \
  "$(POC_PROJECT_PATH)\output\trnspose.obj" \
  "$(POC_PROJECT_PATH)\output\userdll.obj" \
  "$(POC_PROJECT_PATH)\output\realsum.obj" \
  "$(POC_PROJECT_PATH)\output\string.obj"  
  $(LINK) $(LINKFLAGS) -out:"$@" $**


but after i changed it back, the project file got corrupt ?
what could i've done wrong, any ideas ?

ad  "...rather few occasions ..."
i have relatively often the need to change the name and/or
the path of the project files, when i want to reuse a similar
project for a new one.

-tiwag

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
how to rename an output file ?
« Reply #6 on: April 10, 2005, 01:42:41 PM »
Quote from: "tiwag"
copying the file is not sufficient in the case, when you want to debug your dll, when the program which uses the dll wants it in a specific directory.

Now I'm really confused. Why shouldn't the copy work? You copy the DLL to a different directory, and specify the EXE using this DLL as the "Executable helper for DLL projects". When choosing Go/Debug, and the DLL contains debugging info, you should be able to debug the DLL. The EXE will load from it's favorite location, and the debugger will pick this up. Or...?

Quote from: "tiwag"

i have relatively often the need to change the name and/or
the path of the project files, when i want to reuse a similar
project for a new one.

Depends on the file type, I guess. If it's a source file, you can use it directly. If it's a #include or lib file, adding to the Folders tab in Project settings should do the trick. If it's a DLL that is being shared, copying it to a shared location and adding this path to Tools -> Options -> Folders (Executables) is probably the best...

Pelle
/Pelle

tiwag

  • Guest
how to rename an output file ?
« Reply #7 on: April 10, 2005, 06:03:57 PM »
Quote from: "Pelle"
... Why shouldn't the copy work? You copy the DLL to a different directory, and specify the EXE using this DLL as the "Executable helper for DLL projects". When choosing Go/Debug, and the DLL contains debugging info, you should be able to debug the DLL. The EXE will load from it's favorite location, and the debugger will pick this up. Or...?
...


Really it does ! i always thought that the debugger only picks from the destination, from where it was originally linked !
Thanks for the tip ! It's OK now.

-tiwag

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
how to rename an output file ?
« Reply #8 on: April 10, 2005, 07:23:19 PM »
Quote from: "tiwag"
Really it does ! i always thought that the debugger only picks from the destination, from where it was originally linked !

Hard to control it that way - but in the end, a good thing I guess...

Quote from: "tiwag"
Thanks for the tip ! It's OK now.

OK, very good. Thanks.

Pelle
/Pelle