I am trying to add a resource file to include an icon for my win32 form application in Code::Blocks. I created the resource.rc file and added it to my project, and placed my icon in the root folder of the project (where the source files are), and I keep on receiving a preprocessing failed error.
This is what my resource.rc file looks like
#ifndef _resource_rc
#define _resource_rc
MAINICON ICON "icon1.ico"
#endif
My main.cpp file is just a untouched win32 form application, and the project itself is untouched besides adding the resource.rc file to the project.
The build message error is
||preprocessing failed.|
||=== Build finished: 1 errors, 0 warnings ===|
And the build log is
gcc: Files\: No such file or directory
gcc: \(x86\)\CodeBlocks\MinGW\include: No such file or directory
windres.exe: preprocessing failed.
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings
I have checked to make sure where Code::Blocks is installed and it is located in \Program Files(x86)\ where as it seems gcc is looking at a folder called \(x86)\. May this be the problem?
If I remove the resource file, the application compiles and runs correctly.
Thanks for any help.
edit: I've enabled full compiler output and here is what is being ran:
windres.exe -i C:\Users\user\Desktop\MENOET~1\resource.rc -J rc -o obj\Debug\resource.res -O coff -I"C:\Program Files (x86)\CodeBlocks\MinGW\include"
gcc: Files\: No such file or directory
gcc: \(x86\)\CodeBlocks\MinGW\include: No such file or directory
windres.exe: preprocessing failed.
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings
What I've noticed is that MENOET~1 is some sort of abbreviated name of my project directory and that is not its actual name. Not sure if that has anything to do with it, and I cant seem to change it.
edit2: I managed to fix it, but I rather not do it this way. What I did was copy MingGW to C:\ and then went Settings -> Compiler and debugger -> Search directories -> Resource compiler, and set that path to C:\MingGW\include. This allowed relieved all the errors and the build was successful, although I would much rather not have to have copies of MingGW in my root C:\ directory. Is there any way to fix this so it would work with the original path? I'd imagine it is just goofing up on the spaces in the file name, but I cant figure out where to find the build variables to insert quotes.
As per my deductions and enhzflep's settings, I have fixed the problem. The problem is caused by spaces and characters such as brackets being in the path name of the search directories for the resource compiler.
In order to fix this, either move any directories in the resource compilers search directory to C:\ as to remove spaces from it's name, or remove its reference from code::blocks completely.
Both methods worked. Moving the MingGW directory into C:\ and then setting the new search path to C:\MingGW\include fixed this error as well as just removing any reference to this folder in the resource compiler menu.
Both allowed the application to compile successfully.
You can find the resource compiler search directories under
Settings -> Compiler and debugger -> Search directories -> Resource compiler
Related
I am trying to add the application manifest to a program built with C++Builder 2006, by following this article.
(The manifest is to obtain admin rights for my program, which contains "setup" in his name and so it triggers the “This program may not have installed correctly” warning).
I have the MyApp_Setup.exe.manifest in the project folder, along with the MyApp_Setup1.rc file, which is present in the project.
When i try to build, i get:
[RC Fatal Error] MyApp_Setup1.rc(1): File creation failed
What i'm doing wrong, or what should I do?
question edited 'cause i messed up the filenames and the output error didn't matched
Found the problem.
In the project options I always set an "_obj" output folder, but the resource compiler WANTS an existing "debug_build" folder to write the .res file.
It don't create the directory, hence the error in the file creation.
If i remove the "Obj" option, or once you have the "Debug_Build" folder present, everything compiles.
so i downloaded codeblocks codeblocks-13.12mingw-setup-TDM-GCC-481.exe
when i try to run main.cpp i get this error message:
Failed to open 'C:\Users\$imba\Documents\Codeblocks projects\test\main.cpp'.
this is a detailed summary of what i did prior to opening main.cpp
i selected the defaults all the way through the end. I created a seperate folder (called Codeblocks projects) in my documents to save the projects in.
now when i went to create a new folder, i selected console application, C++ and then i named my project test. i decided to create the project in the Codeblocks projects folder that i created. the resulting filename comes out to be C:\Users\$imba\Documents\Codeblocks projects\test\test.cbd
i then selected
GNU GCC Compiler,
'Create Debug Configuration: Debug'
output dir: bin\Debug\
object dir.: obj\Debug\
i selected create Release configuration,: 'Release'
output dir.: bin\release\
objects output dir.: obj\ Release
Finish
when i double click on main.cpp is when i get the error message
Failed to open 'C:\Users\$imba\Documents\Codeblocks projects\test\main.cpp'.
please help, i need this program for my course.
Try saving it in a folder in C:\, like C:\Cpp\. Code::Blocks may be having problems with the space or the $ in the file path.
I just created a new folder CB-Project under my D: drive where I have codeblocks installed.
You may want to look in the directory that you have CB installed in first, you may also find this in program file (x86) or the codeblocks sub directory. Look for a file named that may have proj or project in it's name. If you don't find it you can just create a new folder. You will have to put the new folder name in the CB path so it will find it.
Hi I've a a solution (VS2013, vc++) which has 4 projects (*.vcproj) &
each of them being a EXE project. This is saved in a non-source version
control location in my win8 machine:: Say in
"Documents/NoSourecControlFolder/"
All the projects are compiling fine here.
Now, I moved this "" folder from the non source version control
location to a source version control location "perforce" say "
Documents/P4_workspaces/WorkspaceABC/".
I see that 1 project of out 4 projects in this *.sln doesn't compile fine.
Instead it throws an error like this & doesn't even start compilation ::
1>------ Rebuild All started: Project: ProectABC, Configuration: Release Win32 ------
1>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(4341,5): error MSB3491: Could not write lines to file "Release\ProectABC.vcxproj.FileListAbsolute.txt". The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
The errors says that the file name is too long, but the very same project was compiling perfectly fine in another non-source control location. Also I don't find this file "Release\ProectABC.vcxproj.FileListAbsolute.txt" anywhere.
After refering to this link I got a hint that this has something to do with the change in location of teh file.
Link
Any help would be really helpful. Thanks.
When you changed the location of the source you may change the size of the path of the root directory, example:
If origin source location was: C:\A\B (path size 6) and you moved or copied to C:\D\E\F\G (path size 10), you are adding 10-6=4 characters to all the path of files in the source, if you previously have a file with path length 258 and add the new 4 would exceed the limit (260). So before there is no problem compiling and now the limit is reached.
Check what is the length of the path to the reported file Release\ProectABC.vcxproj.FileListAbsolute.txt
I have received a project from another. When I built, this error occured. I tried to search Google to solve this problem and I followed this link but no effect.
Try doing Rebuild instead of Build. If this doesn't work, try deleting or renaming the Debug and Release directories, and build again.
Keep in mind that Visual Studio often has 2 sets of Release and Debug directories - one set at the top level directory for the solution, and one at the directory for the project.
This could be due to the length of the path for the intermediate files.
The max path length for visual studio is somewhere around 256 characters.
Whilst considering path lengths don't forget that the compiler may use paths such as C:\folder1\folder2\folder3\..\..\folder1a\file.obj, which is longer than you expect for the file C:\folder1\folder1a\file.obj.
Inspect your project settings or build output to see what paths are being used, and perhaps try shortening them.
My problem was case sensitive in Windows 10 for partition e:
I have fixed with:
fsutil.exe file setCaseSensitiveInfo "e:\" disable
I faced the same problem, and it's because I changed my folder name.
ex: I build the solution when its folder name is 'Folder1' and then I close the entire solution and change my folder name into 'Folder2'. When I re-open the solution, and tried to build it, it has error "Fatal error C1083: Cannot open compiler intermediate file: '*\Folder1*.pch': No such file or directory"
But as satuon said, I tried to rebuild instead of build the solution, it's then working.
When creating a simple Remote C++ Development application in Netbeans, I get the following error:
gmake[2]: Entering directory '/path/to/project'
gmake[2]: *** No rule to make target '/path/to/project/cpp/file'
gmake[2]: Leaving directory '/path/to/project'
BUILD FAILED (exit value 2, total time: 1s)
To reproduce this error I simply create a new C/C++ Project, select a remote host that I have already configured. When I add a .ccp file with a corresponding .h file, I get this error. I don't even necessarily have to use or include those files with anything. It appears that Netbeans may not properly build the Makefile to represent the addition of those files to the project?
The problem is, I was using absolute paths for my project. Lesson learned, when developing remote projects using Netbeans, you can not use absolute paths unless the locations of the projects on both machines match exactly.
To configure Netbeans to use relative paths, click the "Tools" option in the menu bar and select "Options". Click the "C/C++" button at the top, and go to the "Project Options" tab. the second option, "File Path Mode:" needs to be set to "Always Relative". This will allow the Makefile to correctly find and compile the file.
Well, considering the output you must have added a file to the makefile (or Netbeans did) that isn't there where it is supposed to be. Therefore it thinks that it is a undeclared target, as targets, the actual target depends on, and the .cpp files the target depends on to compile, are in the same line. I would suggest that you make sure that the makefile is in the correct place and therefore if you follow the exact path you should end up where the file should be, or you configure the vpath variable to consider the directory where the file should be. Else this might give further help as the error message does sound quite the same.