User forums > Using Code::Blocks
Incorrect PROJECT_NAME on switching workspace
(1/1)
empty head:
I've have experienced a problem when switching workspaces where the PROJECT_NAME variable retains the name of the project from the previous workspace.
Steps to reproduce the problem:
Start Code::Blocks with a blank workspace.
Create a new empty project called A.
In Build Options -> Pre/post build steps add the following:
cmd /C echo $(PROJECT_NAME)
Save the workspace as A.workspace.
Repeat the steps above but name the project B and save the workspace as B.workspace.
Exit Code::Blocks
Start Code::Blocks and open A.workspace.
Build the project. The output will be:
--- Code: ----------------- Build: Debug in A (compiler: GNU GCC Compiler)---------------
Linking stage skipped (build target has no object files to link)
Running target post-build steps
cmd /C echo A
A
--- End code ---
Click on File->Recent projects and select B.workspace.
(Don't open via File->Open)
Build the project. The output will be:
--- Code: ----------------- Build: Debug in B (compiler: GNU GCC Compiler)---------------
Linking stage skipped (build target has no object files to link)
Running target post-build steps
cmd /C echo A
A
--- End code ---
Note that the command line has incorrectly used A for PROJECT_NAME whereas the Build heading correctly shows B.
Code::Blocks 12.11
WinXP
oBFusCATed:
--- Quote from: empty head on June 28, 2013, 05:57:23 pm ---(Don't open via File->Open)
--- End quote ---
Does it work if you use it?
empty head:
--- Quote from: oBFusCATed on June 28, 2013, 06:10:35 pm ---
--- Quote from: empty head on June 28, 2013, 05:57:23 pm ---(Don't open via File->Open)
--- End quote ---
Does it work if you use it?
--- End quote ---
Yes and no. It will sometimes work and other times it won't. I haven't noticed a consistent pattern.
By selecting the workspace via File->Recent projects I get the problem occuring consistently every time.
Navigation
[0] Message Index
Go to full version