"unrecognized escape sequence" error on windres

635 views Asked by At

I'm trying to compile a C program with a icon attached.

I'm following this instructions: How do I add an icon to a mingw-gcc compiled executable?

Both Evan's and Steven's replies.

I'm getting this error 4x:

ico.rc:1: unrecognized escape sequence

when I run:

windres ico.rc -O coff -o ico.res

The working dir is where the executable, source file and 'icon.ico' files are. The icon is just an png converted with

ffmpeg -i icon.png icon.ico

The '.rc' file content is:

id ICON ico.ico

My machine is a Windows 10 32-bits with MINGW, without Microsoft Visual Studio.

How can I compile my program with an icon?

1

There are 1 answers

0
Benur21 On

I was searching for the same problem, and found the solution in another site (https://dev-cpp-users.narkive.com/AEWfAsk2/dev-c-problem-with-resource-files), so here I am to share it:

doesn't work because you need to use forward slash (/) as directory seperator - backslash does not work.

Changing the slashes inside the .rc file was enough for it to work (in cause you also need slashes in the windres command, it can be ). Also, the path inside the .rc file doesn't like accents (eg: áàé).

Edit: I just noticed that the How do I add an icon to a mingw-gcc compiled executable? post says in the example

"path/to/my.ico"

not

"path\to\my.ico"