Author Topic: Help with swap header/source  (Read 5554 times)

Offline srins

  • Single posting newcomer
  • *
  • Posts: 8
Help with swap header/source
« on: June 19, 2009, 12:55:33 am »


CB 8.02 REV 5602 WIN XP

When I right-click and try "Swap Header/Source" from the *.C source file, I prompted with Yes/No box "The file does not exist. Do you want to create it?". If I select "YES" it create a new *.h file, which I don't need.
The file extensions are '*.C' and '*.H' (not *.h, *.c).

I have the both header(*.H) and source (*.C) in the Project. I can see them both fine and open them fine. Just that the swap doesn't work for me.
I have toyed around various options in Project properties, Editor settings but nothing seems to do the trick. It is quite possible that I might have missed something obvious.

Help is very much appreciated.


-Srini

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Help with swap header/source
« Reply #1 on: June 19, 2009, 08:57:04 am »
The file extensions are '*.C' and '*.H' (not *.h, *.c).
I might also be a bug. In fact that's the first time I see anybody using capital letters for the file extension. When comparing the file extension this might be an issue because on windows this comparison should be case in-sensitive... Need to check that...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Help with swap header/source
« Reply #2 on: June 19, 2009, 11:40:02 am »
It works for me correctly on linux.

It also works on windows, but the extension shown in the editor tab is in lower-case, if I open the file with swap header/source.

If I then double-click the file in the project-tree, the extension is changed to uppercase (as on disk).

If both files are opened everything is okay.

Offline srins

  • Single posting newcomer
  • *
  • Posts: 8
Re: Help with swap header/source
« Reply #3 on: June 19, 2009, 02:59:24 pm »

Thanks for looking up on this issue.

Interestingly the swap works perfectly when I try from within Header file (*.H). It smoothly switches to appropriate C file.
So, the swap is not working for me from C to H only.

-Srini

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Help with swap header/source
« Reply #4 on: June 19, 2009, 03:11:21 pm »
So, the swap is not working for me from C to H only.
Can you provide a sample project? I cannot produce at all. Probably just strip down your project to a minimal sample and attach it to another post in this thread.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline srins

  • Single posting newcomer
  • *
  • Posts: 8
Re: Help with swap header/source
« Reply #5 on: June 20, 2009, 02:03:17 am »

Here is the pared down version of project xml file. I hope this is what you were asking for.
Thanks again.

--------->>>

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
   <FileVersion major="1" minor="6" />
   <Project>
      <Option title="MyProject4" />
      <Option pch_mode="2" />
      <Option compiler="gcc" />
      <Build>
         <Target title="Debug">
            <Option output="bin\Debug\MyProject4" prefix_auto="1" extension_auto="1" />
            <Option object_output="obj\Debug\" />
            <Option type="1" />
            <Option compiler="gcc" />
            <Compiler>
               <Add option="-g" />
            </Compiler>
         </Target>
      </Build>
      <Compiler>
         <Add option="-Wall" />
      </Compiler>
   
      <Unit filename="X:\MyCommonSrc\include\IModelGREV01.H" />
      <Unit filename="X:\MyCommonSrc\include\IModelStgyGREV02.H" />
         <Option compilerVar="CC" />
      </Unit>
      <Unit filename="X:\MyCommonSrc\src\IModelGREV01.C">
         <Option compilerVar="CC" />
      </Unit>
      <Unit filename="X:\MyCommonSrc\src\IModelStgyGREV02.C">
         <Option compilerVar="CC" />
      </Unit>
      <Extensions>
         <code_completion>
            <search_path add="U:\mysrc\dinclude" />
            <search_path add="U:\mysrc\dlib" />
            <search_path add="U:\mysrc\finclude" />
            <search_path add="U:\mysrc\RogueWave" />
            <search_path add="..\RW" />
            <search_path add="X:\MyCommonSrc\include" />
            <search_path add="X:\MyCommonSrc\src" />
         </code_completion>
         <envvars />
         <debugger />
         <lib_finder disable_auto="1" />
      </Extensions>
   </Project>
</CodeBlocks_project_file>

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Help with swap header/source
« Reply #6 on: June 22, 2009, 07:01:39 am »
            <search_path add="U:\mysrc\finclude" />
            <search_path add="X:\MyCommonSrc\include" />
I don't recall exactly, but I believe path's on different folders are not harmful on Windows. Try putting all your files on *one* drive (temporarily), adjust the project file and try, if if works then.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline srins

  • Single posting newcomer
  • *
  • Posts: 8
Re: Help with swap header/source
« Reply #7 on: June 24, 2009, 12:23:04 am »

Unfortunately, merging into 1 project did not make any difference.
I am happy that atleast H -> C works good for me.