User forums > Using Code::Blocks

resource.rc hides the include directory

(1/2) > >>

jurhas:
I have a problem with a project, if I include the resource.rc files, codeblocks doesn't find the directory postgres (in this case)
The resource.rc has only this instruction:

--- Code: ---aaaa ICON "ico.ico"
--- End code ---

but I tried without any instruction, but the same the compiler raise this two errors:

--- Quote ---||=== Build: Debug in TBGUI (compiler: GNU GCC Compiler) ===|
 Files\PostgreSQL\15\include||No such file or directory|
||preprocessing failed.|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|


--- End quote ---
If I exclude the file resource.rc it works again.
I have another program with the same directory included with the wxWidgets icon and  it works fine
I have no clue where to put my hand, so I don't know wich other information  you need.
Do you can help me?


Miguel Gimenez:
How are you "including" resource.rc? There is no need to include it, resource.res (the compiled version) will be linked automatically.

Post a full build log following this instructions.

jurhas:

--- Quote --- Build started on: 21-12-2022 at 16:30.14
Build ended on: 21-12-2022 at 16:30.36

-------------- Build: Debug in TBGUI (compiler: GNU GCC Compiler)---------------
g++.exe -Wall -pipe -mthreads -Wno-attributes -Winvalid-pch -include wx_pch.h -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -DWX_PRECOMP -g -I"C:\Program Files\PostgreSQL\15\include" -I\Treebase -IC:\wxWidgets-3.2.1\include -IC:\wxWidgets-3.2.1\lib\gcc_lib\mswud -I\treebase -Iinclude -c C:\Users\jurha\Documents\codeblocksprojects\TBGUI\BindTreeToCertificate.cpp -o obj\Debug\BindTreeToCertificate.o
g++.exe -Wall -pipe -mthreads -Wno-attributes -Winvalid-pch -include wx_pch.h -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -DWX_PRECOMP -g -I"C:\Program Files\PostgreSQL\15\include" -I\Treebase -IC:\wxWidgets-3.2.1\include -IC:\wxWidgets-3.2.1\lib\gcc_lib\mswud -I\treebase -Iinclude -c C:\Users\jurha\Documents\codeblocksprojects\TBGUI\Certificate.cpp -o obj\Debug\Certificate.o
g++.exe -Wall -pipe -mthreads -Wno-attributes -Winvalid-pch -include wx_pch.h -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -DWX_PRECOMP -g -I"C:\Program Files\PostgreSQL\15\include" -I\Treebase -IC:\wxWidgets-3.2.1\include -IC:\wxWidgets-3.2.1\lib\gcc_lib\mswud -I\treebase -Iinclude -c C:\Users\jurha\Documents\codeblocksprojects\TBGUI\ChangePassword.cpp -o obj\Debug\ChangePassword.o
g++.exe -Wall -pipe -mthreads -Wno-attributes -Winvalid-pch -include wx_pch.h -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -DWX_PRECOMP -g -I"C:\Program Files\PostgreSQL\15\include" -I\Treebase -IC:\wxWidgets-3.2.1\include -IC:\wxWidgets-3.2.1\lib\gcc_lib\mswud -I\treebase -Iinclude -c C:\Users\jurha\Documents\codeblocksprojects\TBGUI\dlgDrawer.cpp -o obj\Debug\dlgDrawer.o
g++.exe -Wall -pipe -mthreads -Wno-attributes -Winvalid-pch -include wx_pch.h -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -DWX_PRECOMP -g -I"C:\Program Files\PostgreSQL\15\include" -I\Treebase -IC:\wxWidgets-3.2.1\include -IC:\wxWidgets-3.2.1\lib\gcc_lib\mswud -I\treebase -Iinclude -c C:\Users\jurha\Documents\codeblocksprojects\TBGUI\DocBuilder.cpp -o obj\Debug\DocBuilder.o
g++.exe -Wall -pipe -mthreads -Wno-attributes -Winvalid-pch -include wx_pch.h -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -DWX_PRECOMP -g -I"C:\Program Files\PostgreSQL\15\include" -I\Treebase -IC:\wxWidgets-3.2.1\include -IC:\wxWidgets-3.2.1\lib\gcc_lib\mswud -I\treebase -Iinclude -c C:\Users\jurha\Documents\codeblocksprojects\TBGUI\Documents.cpp -o obj\Debug\Documents.o
g++.exe -Wall -pipe -mthreads -Wno-attributes -Winvalid-pch -include wx_pch.h -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -DWX_PRECOMP -g -I"C:\Program Files\PostgreSQL\15\include" -I\Treebase -IC:\wxWidgets-3.2.1\include -IC:\wxWidgets-3.2.1\lib\gcc_lib\mswud -I\treebase -Iinclude -c C:\Users\jurha\Documents\codeblocksprojects\TBGUI\DocViewer.cpp -o obj\Debug\DocViewer.o
g++.exe -Wall -pipe -mthreads -Wno-attributes -Winvalid-pch -include wx_pch.h -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -DWX_PRECOMP -g -I"C:\Program Files\PostgreSQL\15\include" -I\Treebase -IC:\wxWidgets-3.2.1\include -IC:\wxWidgets-3.2.1\lib\gcc_lib\mswud -I\treebase -Iinclude -c C:\Users\jurha\Documents\codeblocksprojects\TBGUI\HelpFunctions.cpp -o obj\Debug\HelpFunctions.o
In file included from C:\Users\jurha\Documents\codeblocksprojects\TBGUI\DocBuilder.cpp:1:
C:\Users\jurha\Documents\codeblocksprojects\TBGUI\DocBuilder.h: In constructor 'mRichText::mRichText(wxWindow*, wxWindowID, const wxString&, const wxPoint&, const wxSize&, long int, const wxValidator&, const wxString&)':
C:\Users\jurha\Documents\codeblocksprojects\TBGUI\DocBuilder.h:38:56: warning: 'wxFont::wxFont(int, int, int, int, bool, const wxString&, wxFontEncoding)' is deprecated: use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants ie: wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD [-Wdeprecated-declarations]
wxFont font(10, wxROMAN, wxNORMAL, wxNORMAL);
^
In file included from C:\wxWidgets-3.2.1\include/wx/font.h:627,
from C:\wxWidgets-3.2.1\include/wx/window.h:23,
from C:\wxWidgets-3.2.1\include/wx/msw/private.h:21,
from C:\wxWidgets-3.2.1\include/wx/wxprec.h:33,
from ./wx_pch.h:14,
from <command-line>:
C:\wxWidgets-3.2.1\include/wx/msw/font.h:130:5: note: declared here
wxFont(int size,
^~~~~~
g++.exe -Wall -pipe -mthreads -Wno-attributes -Winvalid-pch -include wx_pch.h -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -DWX_PRECOMP -g -I"C:\Program Files\PostgreSQL\15\include" -I\Treebase -IC:\wxWidgets-3.2.1\include -IC:\wxWidgets-3.2.1\lib\gcc_lib\mswud -I\treebase -Iinclude -c C:\Users\jurha\Documents\codeblocksprojects\TBGUI\ItmOnCertUpdate.cpp -o obj\Debug\ItmOnCertUpdate.o
g++.exe -Wall -pipe -mthreads -Wno-attributes -Winvalid-pch -include wx_pch.h -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -DWX_PRECOMP -g -I"C:\Program Files\PostgreSQL\15\include" -I\Treebase -IC:\wxWidgets-3.2.1\include -IC:\wxWidgets-3.2.1\lib\gcc_lib\mswud -I\treebase -Iinclude -c C:\Users\jurha\Documents\codeblocksprojects\TBGUI\licence.cpp -o obj\Debug\licence.o
g++.exe -Wall -pipe -mthreads -Wno-attributes -Winvalid-pch -include wx_pch.h -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -DWX_PRECOMP -g -I"C:\Program Files\PostgreSQL\15\include" -I\Treebase -IC:\wxWidgets-3.2.1\include -IC:\wxWidgets-3.2.1\lib\gcc_lib\mswud -I\treebase -Iinclude -c C:\Users\jurha\Documents\codeblocksprojects\TBGUI\LocksDlg.cpp -o obj\Debug\LocksDlg.o
g++.exe -Wall -pipe -mthreads -Wno-attributes -Winvalid-pch -include wx_pch.h -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -DWX_PRECOMP -g -I"C:\Program Files\PostgreSQL\15\include" -I\Treebase -IC:\wxWidgets-3.2.1\include -IC:\wxWidgets-3.2.1\lib\gcc_lib\mswud -I\treebase -Iinclude -c C:\Users\jurha\Documents\codeblocksprojects\TBGUI\MaterialFilter.cpp -o obj\Debug\MaterialFilter.o
C:\Users\jurha\Documents\codeblocksprojects\TBGUI\licence.cpp: In function 'int init_licence()':
C:\Users\jurha\Documents\codeblocksprojects\TBGUI\licence.cpp:280:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
} ;
^
C:\Users\jurha\Documents\codeblocksprojects\TBGUI\licence.cpp:280:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
C:\Users\jurha\Documents\codeblocksprojects\TBGUI\licence.cpp:280:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
C:\Users\jurha\Documents\codeblocksprojects\TBGUI\licence.cpp:280:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
C:\Users\jurha\Documents\codeblocksprojects\TBGUI\licence.cpp:280:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
g++.exe -Wall -pipe -mthreads -Wno-attributes -Winvalid-pch -include wx_pch.h -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -DWX_PRECOMP -g -I"C:\Program Files\PostgreSQL\15\include" -I\Treebase -IC:\wxWidgets-3.2.1\include -IC:\wxWidgets-3.2.1\lib\gcc_lib\mswud -I\treebase -Iinclude -c C:\Users\jurha\Documents\codeblocksprojects\TBGUI\NewChild.cpp -o obj\Debug\NewChild.o
g++.exe -Wall -pipe -mthreads -Wno-attributes -Winvalid-pch -include wx_pch.h -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -DWX_PRECOMP -g -I"C:\Program Files\PostgreSQL\15\include" -I\Treebase -IC:\wxWidgets-3.2.1\include -IC:\wxWidgets-3.2.1\lib\gcc_lib\mswud -I\treebase -Iinclude -c C:\Users\jurha\Documents\codeblocksprojects\TBGUI\NewMaterial.cpp -o obj\Debug\NewMaterial.o
C:\Users\jurha\Documents\codeblocksprojects\TBGUI\LocksDlg.cpp: In member function 'void LocksDlg::Show(PGconn*, ptbNode)':
C:\Users\jurha\Documents\codeblocksprojects\TBGUI\LocksDlg.cpp:222:17: warning: format '%d' expects argument of type 'int', but argument 3 has type 'll_64' {aka 'long long int'} [-Wformat=]
sprintf(qry,"SELECT parent,id,rl_name,tb_id,tb_user,"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"tb_locktype,can_grant,path FROM user_locks WHERE tb_id=" TBLONGLONGPATTERN " AND path >'' ORDER BY PATH",node->id );
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~
C:\Users\jurha\Documents\codeblocksprojects\TBGUI\MaterialFilter.cpp: In constructor 'MaterialFilter::MaterialFilter(wxWindow*, wxWindowID, const wxPoint&, const wxSize&)':
C:\Users\jurha\Documents\codeblocksprojects\TBGUI\MaterialFilter.cpp:46:104: warning: 'wxFont::wxFont(int, int, int, int, bool, const wxString&, wxFontEncoding)' is deprecated: use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants ie: wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD [-Wdeprecated-declarations]
wxFont StaticText1Font(12,wxSWISS,wxFONTSTYLE_NORMAL,wxBOLD,false,_T("Calibri"),wxFONTENCODING_DEFAULT);
^
In file included from C:\wxWidgets-3.2.1\include/wx/font.h:627,
from C:\wxWidgets-3.2.1\include/wx/window.h:23,
from C:\wxWidgets-3.2.1\include/wx/msw/private.h:21,
from C:\wxWidgets-3.2.1\include/wx/wxprec.h:33,
from ./wx_pch.h:14,
from <command-line>:
C:\wxWidgets-3.2.1\include/wx/msw/font.h:130:5: note: declared here
wxFont(int size,
^~~~~~
g++.exe -Wall -pipe -mthreads -Wno-attributes -Winvalid-pch -include wx_pch.h -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -DWX_PRECOMP -g -I"C:\Program Files\PostgreSQL\15\include" -I\Treebase -IC:\wxWidgets-3.2.1\include -IC:\wxWidgets-3.2.1\lib\gcc_lib\mswud -I\treebase -Iinclude -c C:\Users\jurha\Documents\codeblocksprojects\TBGUI\newMaterialClassDlg.cpp -o obj\Debug\newMaterialClassDlg.o
g++.exe -Wall -pipe -mthreads -Wno-attributes -Winvalid-pch -include wx_pch.h -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -DWX_PRECOMP -g -I"C:\Program Files\PostgreSQL\15\include" -I\Treebase -IC:\wxWidgets-3.2.1\include -IC:\wxWidgets-3.2.1\lib\gcc_lib\mswud -I\treebase -Iinclude -c C:\Users\jurha\Documents\codeblocksprojects\TBGUI\OpenSchDocDlg.cpp -o obj\Debug\OpenSchDocDlg.o
windres.exe -IC:\wxWidgets-3.2.1\lib\gcc_lib\mswud -I"C:\Program Files\PostgreSQL\15\include" -IC:\wxWidgets-3.2.1\include -J rc -O coff -i C:\Users\jurha\DOCUME~1\CODEBL~1\TBGUI\resource.rc -o obj\Debug\resource.res
gcc: error: Files\PostgreSQL\15\include: No such file or directory
windres.exe: preprocessing failed.
Process terminated with status 1 (0 minute(s), 21 second(s))
Process terminated with status 0 (0 minute(s), 22 second(s))
2 error(s), 8 warning(s) (0 minute(s), 22 second(s))

--- End quote ---

The warnings with the strings can not be avoided, since I use C libraries and for performance reason (first I check if exists if not I strdup() the string) so earlier or later I have the warning , and the sprintf I cannot understand why I have this warning since TBLONGLONGPATTERN is declared as

--- Code: ---#define TBLONGLONGPATTERN "%I64d"
--- End code ---

PB:

--- Quote from: jurhas on December 21, 2022, 04:41:24 pm ---
--- Quote ---windres.exe -IC:\wxWidgets-3.2.1\lib\gcc_lib\mswud -I"C:\Program Files\PostgreSQL\15\include" -IC:\wxWidgets-3.2.1\include -J rc -O coff -i C:\Users\jurha\DOCUME~1\CODEBL~1\TBGUI\resource.rc -o obj\Debug\resource.res
gcc: error: Files\PostgreSQL\15\include: No such file or directory
windres.exe: preprocessing failed.
Process terminated with status 1 (0 minute(s), 21 second(s))
Process terminated with status 0 (0 minute(s), 22 second(s))
2 error(s), 8 warning(s) (0 minute(s), 22 second(s))

--- End quote ---

--- End quote ---

I think it is pretty clear why this fails. It fails because windres has an invalid include path (i.e., Files\PostgreSQL\15\include). It seems that your version of windres still cannot deal with paths with spaces even when they are in quotes. You can see that C::B converts the long name for the .rc file to the short one but the include paths are not.

Of course, when you have no .rc file in the project, windres (GCC's resource compiler) is not invoked so the build succeeds.

BTW, I think you can avoid all the warnings too. Using a non-deprecated wxFont ctor is a no brainer and the rest should be avoided by doing proper casts or conversions.

EDIT
I just tried to build a wizard-generated project where I added in project build options to Search Directories / Resource Compiler path C:\dev\Folder with Spaces\include

--- Quote ---windres.exe -ID:\Dev\Desktop\!Lib\wxWidgets-3.2.1\include -ID:\Dev\Desktop\!Lib\wxWidgets-3.2.1\lib\gcc_dll-x64\mswud -I"C:\dev\Folder with Spaces\include"  -J rc -O coff -i C:\dev\cb-tests\Test321b\resource.rc -o obj\Debug\resource.res
g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Wall -g -D__WXDEBUG__ -ID:\Dev\Desktop\!Lib\wxWidgets-3.2.1\include -ID:\Dev\Desktop\!Lib\wxWidgets-3.2.1\lib\gcc_dll-x64\mswud -c C:\dev\cb-tests\Test321b\Test321bApp.cpp -o obj\Debug\Test321bApp.o
g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Wall -g -D__WXDEBUG__ -ID:\Dev\Desktop\!Lib\wxWidgets-3.2.1\include -ID:\Dev\Desktop\!Lib\wxWidgets-3.2.1\lib\gcc_dll-x64\mswud -c C:\dev\cb-tests\Test321b\Test321bMain.cpp -o obj\Debug\Test321bMain.o
g++.exe -LD:\Dev\Desktop\!Lib\wxWidgets-3.2.1\lib\gcc_dll-x64 -o bin\Debug\Test321b.exe  obj\Debug\Test321bApp.o obj\Debug\Test321bMain.o obj\Debug\resource.res -mthreads  -lwxmsw32ud_core -lwxbase32ud -mwindows
Output file is bin\Debug\Test321b.exe with size 908.50 KB
--- End quote ---

and windres did not complain at all. However, I use the up-to-date MSYS2 mingw-w64-x86_64-toolchain package (windres v2.39).

Miguel Gimenez:
I doubt the PostgreSQL include path should be at all in the resource compiler search directories. I have

--- Code: ---$(#wx32)\include  (in General options)
$(#wx32)\lib\gcc_lib\mswu  (in Release target)

--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version