Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: Alturin on May 21, 2007, 09:15:42 pm

Title: Bug? Swap header/source -> file does not exist yet
Post by: Alturin on May 21, 2007, 09:15:42 pm
Steps to reproduce:
Create a new C project (not C++).
Create a new header file.
Right click and click "Swap header/source"
When a .c file should be created, instead a .cpp file is made.

This turned out to be a very annoying 'bug' for me to trackdown, because the compiler kept telling me about undefined functions, which I was sure were in the according .c file (which turned out later was a .cpp file!).

Is this an actual bug, or intentional?

Thank you for your time,

Alturin.
Title: Re: Bug? Swap header/source -> file does not exist yet
Post by: Biplab on May 21, 2007, 09:28:43 pm
Create a new C project (not C++).

Creating a C project doesn't ensure that all the files will be C file. That option is asked to copy the respective sample code during project creation.
Title: Re: Bug? Swap header/source -> file does not exist yet
Post by: Alturin on May 22, 2007, 01:50:13 am
Is it possible to add an option somewhere in the "Create new file" dialog?
Cos at the moment I have to "rename file", "remove file from project", "add file to project" in order to fix it to it being a proper C file again.
Title: Re: Bug? Swap header/source -> file does not exist yet
Post by: mandrav on May 22, 2007, 08:47:52 am
Is it possible to add an option somewhere in the "Create new file" dialog?

Ctrl+Shift+N
Title: Re: Bug? Swap header/source -> file does not exist yet
Post by: Alturin on May 22, 2007, 08:46:32 pm
Is it possible to add an option somewhere in the "Create new file" dialog?

Ctrl+Shift+N

I mean the dialog you get after you hit "Swap header / source" -> "Error: The file does not exist. Do you want to create it?" -> Yes -> "Do you want this new file to the active project?" -> Yes -> "Select all" -> Ok.
Somewhere in that chain, there might could be an option "Create as CPP file / Create as C file"?
Title: Re: Bug? Swap header/source -> file does not exist yet
Post by: Biplab on May 22, 2007, 09:06:57 pm
Use File > New > File... and then select C/C++ Source option.