Bug #13793 2008-05-11 20:52
jimp
Linking Problem with Global Variables
Linking Problem with Global Variables I have a problem when compiling the CodeBlocks project ContribPlugins.workspace on Windows. It uses global variables and I am using a directory with spaces in the name. Linking AutoVersioning gets the following error. At the end of the command line note that the -o option is not enclosed in quotes and a directory name, "Visual Studio 2008", contains spaces. mingw32-g++.exe -shared -Wl,--dll -L"C:\Users\jp\Documents\Visual Studio 2008\Projects\CodeBlocks\src\devel" -LC:\Programs\wxWidgets-2.8.7\lib\gcc_dll -LC:\Programs\MinGW\lib -LC:\Programs\MinGW\lib\gcc\mingw32\3.4.5 "C:\Users\jp\Documents\Visual Studio 2008\Projects\CodeBlocks\src\.objs\plugins\contrib\AutoVersioning\avChangesDlg.o" "C:\Users\jp\Documents\Visual Studio 2008\Projects\CodeBlocks\src\.objs\plugins\contrib\AutoVersioning\avHeader.o" "C:\Users\jp\Documents\Visual Studio 2008\Projects\CodeBlocks\src\.objs\plugins\contrib\AutoVersioning\avSvnRevision.o" "C:\Users\jp\Documents\Visual Studio 2008\Projects\CodeBlocks\src\.objs\plugins\contrib\AutoVersioning\avVersionEditorDlg.o" "C:\Users\jp\Documents\Visual Studio 2008\Projects\CodeBlocks\src\.objs\plugins\contrib\AutoVersioning\AutoVersioning.o" -o C:\Users\jp\Documents\Visual Studio 2008\Projects\CodeBlocks\src\devel\share\codeblocks\plugins\AutoVersioning.dll -lwxmsw28u -lcodeblocks mingw32-g++.exe: Studio: No such file or directory mingw32-g++.exe: 2008\Projects\CodeBlocks\src\devel\share\codeblocks\plugins\AutoVersioning.dll: No such file or directory In the function QuoteStringIfNeeded(wxString& str) in sdk\globals.cpp the "$(#cb)" global variable has not been expanded so that "str" has the following value when passed to the function: $(#cb)\devel\share\codeblocks\plugins\AutoVersioning.dll Since there are no spaces it is not quoted. But when $(#cb) is replaced, there are spaces and the link fails. The include directories and library directories which came thru this function had the global variable already expanded. And they are quoted if needed as you can see in the above linker statement. I patched the problem by checking for $ in QuoteStringIfNeeded(wxString& str) and enclosing the directory in quotes. But this is probably not the permanent solution you would want. The global variable for the linker should be replaced before calling QuoteStringIfNeeded() like the others.
- Category
- Compiler
- Group
- Status
- Open
- Close date
- Assigned to