News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Help with swap header/source

Started by srins, June 19, 2009, 12:55:33 AM

Previous topic - Next topic

srins



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

MortenMacFly

Quote from: srins on June 19, 2009, 12:55:33 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: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

Jenna

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.

srins


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

MortenMacFly

Quote from: srins on June 19, 2009, 02:59:24 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: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

srins


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>

MortenMacFly

Quote from: srins on June 20, 2009, 02:03:17 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: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

srins


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