I put a relative path to Mingw using variables in Codeblocks
Example: for the toolchain path, I use
$(Codeblocks)\..\..\BIN\MingW_TDM
(see screenshot)
It works fine for everything: toolchain (Mingw, mingw TDM, MSVC, Help plugin, tool plugin)
In addition, I use the CBLauncher from biplap (search the forums).
I save all my config in $(Codeblocks)\AppData (delete every other conf files you may find on your system: in CB directory, in C:\Users\<user>\AppData\Roaming\codeblocks (Windows Vista), ...)
And I use a bat file to set the path to other utilities, such as CMake or Doxygen. (The .bat sets the PATH variable, and then launch CBLauncher).
This way, I have CodeBlocks + 2 compilers + Libraries + additional tools inside 1 folder that I move around. The path can have spaces in it.
At work, this folder stays on my desktop.
Hope this helps.
Sebastien
[attachment deleted by admin]
i know....but i ask for you personal configuated portable...
perhaps if its okay for you...can i have it?
This is what I told you: this is NOT a specific build of Code::Blocks.
The only thing I do is to use the $(CodeBlocks) variable everywhere in my settings. (compiler toolchain, help files, tools, global variables)
Just try it !
I know it is working for :
- Mingw, Mingw TDM, MSVC09
- with spaces in the installation path ("Documents and Settings\UserName\Desktop\" for example)
- installation on another drive (D:\)
If you have full path in your default.conf, then it means you are using full paths in your settings. You have to find the correct options.
I have checked my default.conf, and I have no full path in it. See for example:
<MASTER_PATH>
<str>
<![CDATA[$(Codeblocks)\..\..\BIN\MingW_TDM]]>
</str>
</MASTER_PATH>
So just try to use the $(CodeBlocks) variable: Set your options, QUIT codeblocks (to save the file) and start it again.
ok, I pasted below two logs taken from the debug window.
I have omitted, in both cases, the first 170 lines, because identical and, imho, not very interesting.
Compiler absolute path: I:\CB1005NB\MinGW
...
Done loading project in 47ms
Project's base path: I:\_Prj\Test\
Project's common toplevel path: I:\_Prj\Test\
Text seems to be pure ASCII!
We use user specified encoding: Windows Western European (CP 1252) (ID: 33)
Final encoding detected: Windows Western European (CP 1252) (ID: 33)
Editor Open
project data set for I:\_Prj\Test\main.cpp
Top Editor: I:\_Prj\Test\main.cpp
Caching GCC dir: I:\CB1005NB\MinGW\lib\gcc\mingw32\4.5.2\include\c++
Caching GCC dir: I:\CB1005NB\MinGW\lib\gcc\mingw32\4.5.2\include\c++\mingw32
Caching GCC dir: I:\CB1005NB\MinGW\lib\gcc\mingw32\4.5.2\include\c++\backward
Caching GCC dir: I:\CB1005NB\MinGW\include
Caching GCC dir: I:\CB1005NB\MinGW\lib\gcc\mingw32\4.5.2\include
Caching GCC dir: I:\CB1005NB\MinGW\lib\gcc\mingw32\4.5.2\include-fixed
Passing list of files to batch-parser.
Header to parse with priority: 'I:\CB1005NB\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cstddef'
Header to parse with priority: 'I:\CB1005NB\MinGW\include\w32api.h'
Add 2 priority parsing file(s) for project 'TestPrj'...
Added 2 file(s) for project 'TestPrj' to batch-parser...
Create new parser for project 'TestPrj'
Starting batch parsing for project 'TestPrj'...
Project 'TestPrj' parsing stage done!
Project 'TestPrj' parsing stage done (26 total parsed files, 16297 tokens in 0 minute(s), 1.156 seconds).
Updating class browser...
Class browser updated.
Compiler relative path: $(CODEBLOCKS)\MinGW
...
Done loading project in 31ms
Project's base path: I:\_Prj\Test\
Project's common toplevel path: I:\_Prj\Test\
Text seems to be pure ASCII!
We use user specified encoding: Windows Western European (CP 1252) (ID: 33)
Final encoding detected: Windows Western European (CP 1252) (ID: 33)
Editor Open
project data set for I:\_Prj\Test\main.cpp
Top Editor: I:\_Prj\Test\main.cpp
AddCompilerPredefinedMacros failed!
Passing list of files to batch-parser.
Added 2 file(s) for project 'TestPrj' to batch-parser...
Create new parser for project 'TestPrj'
Starting batch parsing for project 'TestPrj'...
Project 'TestPrj' parsing stage done!
Project 'TestPrj' parsing stage done (3 total parsed files, 21 tokens in 0 minute(s), 0.016 seconds).
Updating class browser...
Class browser updated.
Compiler relative path: $(CODEBLOCKS)\MinGW
This is the problem, the CC doesn't do macro replacements, it seems...
Index: E:/code/cb/cb_trunk/src/plugins/codecompletion/nativeparser.cpp
===================================================================
--- E:/code/cb/cb_trunk/src/plugins/codecompletion/nativeparser.cpp (revision 7475)
+++ E:/code/cb/cb_trunk/src/plugins/codecompletion/nativeparser.cpp (working copy)
@@ -663,7 +663,9 @@
if (compiler->GetID().Contains(_T("gcc")))
{
wxFileName fn(wxEmptyString, compiler->GetPrograms().CPP);
- fn.SetPath(compiler->GetMasterPath());
+ wxString masterPath = compiler->GetMasterPath();
+ Manager::Get()->GetMacrosManager()->ReplaceMacros(masterPath);
+ fn.SetPath(masterPath);
fn.AppendDir(_T("bin"));
const wxArrayString& gccDirs = GetGCCCompilerDirs(fn.GetFullPath());
TRACE(_T("Adding %d cached gcc dirs to parser..."), gccDirs.GetCount());
@@ -792,7 +794,9 @@
if (CompilerID.Contains(_T("gcc")))
{
wxFileName fn(wxEmptyString, ((Compilers[idxCompiler])->GetPrograms()).CPP);
- fn.SetPath((Compilers[idxCompiler])->GetMasterPath());
+ wxString masterPath = (Compilers[idxCompiler])->GetMasterPath();
+ Manager::Get()->GetMacrosManager()->ReplaceMacros(masterPath);
+ fn.SetPath(masterPath);
fn.AppendDir(_T("bin"));
const wxArrayString& gccDirs = GetGCCCompilerDirs(fn.GetFullPath());
TRACE(_T("Adding %d cached gcc dirs to parser..."), gccDirs.GetCount());
@@ -837,7 +841,9 @@
return false;
wxFileName fn(wxEmptyString, compiler->GetPrograms().CPP);
- fn.SetPath(compiler->GetMasterPath());
+ wxString masterPath = compiler->GetMasterPath();
+ Manager::Get()->GetMacrosManager()->ReplaceMacros(masterPath);
+ fn.SetPath(masterPath);
fn.AppendDir(_T("bin"));
static std::map<wxString, wxString> defsMap;
@@ -917,7 +923,10 @@
Compiler* compiler = CompilerFactory::GetCompiler(compilerId);
if(!compiler)
return false;
- wxString cmd = compiler->GetMasterPath() + _T("\\bin\\") + compiler->GetPrograms().C;
+
+ wxString masterPath = compiler->GetMasterPath();
+ Manager::Get()->GetMacrosManager()->ReplaceMacros(masterPath);
+ wxString cmd = masterPath + _T("\\bin\\") + compiler->GetPrograms().C;
Manager::Get()->GetMacrosManager()->ReplaceMacros(cmd);
// wxExecute can be a long action and C::B might have been shutdown in the meantime...
The patch should fix the problem, but do we need to refactor the function body GetMasterPath()?