* Can't link .res file (from windres) using i686-pc-mingw32-g++
@ 2016-02-25 3:57 Jim Reisert AD1C
2016-02-25 4:29 ` Mark Geisert
0 siblings, 1 reply; 4+ messages in thread
From: Jim Reisert AD1C @ 2016-02-25 3:57 UTC (permalink / raw)
To: cygwin
I have a 64-bit Cygwin environment. I'm trying to compile a 32-bit
(target) Windows program using i686-pc-mingw32-g++
# i686-pc-mingw32-g++ -g -Wall -Iinclude -I../../library/include -c
-o NPOTAdlg.o NPOTAdlg.cpp
# windres -Iinclude res/NPOTAdlg.rc -O coff -o res/NPOTAdlg.res
# i686-pc-mingw32-g++ -s -mwindows -static-libgcc -static-libstdc++
-lwininet NPOTA.o NPOTAdlg.o res/NPOTAdlg.res ../../library/library.a
/usr/i686-pc-mingw32/sys-root/mingw/lib/libwininet.a -o NPOTA
But I get this error on the link (last) step:
res/NPOTAdlg.res: file not recognized: File format not recognized
This program is a clone of another program I wrote a couple of years
ago (I wanted to re-use the Windows framework I had developed).
However, at that time, I was using 32-bit Cygwin, not 64-bit Cygwin.
Is there a work-around for this, other than re-creating a 32-bit
Cygwin environment?
Thanks - Jim
--
Jim Reisert AD1C, <jjreisert@alum.mit.edu>, http://www.ad1c.us
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Can't link .res file (from windres) using i686-pc-mingw32-g++
2016-02-25 3:57 Can't link .res file (from windres) using i686-pc-mingw32-g++ Jim Reisert AD1C
@ 2016-02-25 4:29 ` Mark Geisert
2016-02-25 5:18 ` Tony Kelman
2016-02-25 14:50 ` Jim Reisert AD1C
0 siblings, 2 replies; 4+ messages in thread
From: Mark Geisert @ 2016-02-25 4:29 UTC (permalink / raw)
To: cygwin
Jim Reisert AD1C wrote:
> I have a 64-bit Cygwin environment. I'm trying to compile a 32-bit
> (target) Windows program using i686-pc-mingw32-g++
>
> # i686-pc-mingw32-g++ -g -Wall -Iinclude -I../../library/include -c
> -o NPOTAdlg.o NPOTAdlg.cpp
> # windres -Iinclude res/NPOTAdlg.rc -O coff -o res/NPOTAdlg.res
> # i686-pc-mingw32-g++ -s -mwindows -static-libgcc -static-libstdc++
> -lwininet NPOTA.o NPOTAdlg.o res/NPOTAdlg.res ../../library/library.a
> /usr/i686-pc-mingw32/sys-root/mingw/lib/libwininet.a -o NPOTA
>
> But I get this error on the link (last) step:
>
> res/NPOTAdlg.res: file not recognized: File format not recognized
>
> This program is a clone of another program I wrote a couple of years
> ago (I wanted to re-use the Windows framework I had developed).
> However, at that time, I was using 32-bit Cygwin, not 64-bit Cygwin.
>
> Is there a work-around for this, other than re-creating a 32-bit
> Cygwin environment?
Just a guess: your 64-bit windres is generating a 64-bit .res file that the
32-bit g++ can't grok. Look at 'windres -h'. There's a "-F" == "--target" flag
that can specify a target type. I would try adding "-F pe-i386" after the "-O
coff" on your command. If windres doesn't accept both -O and -F, try leaving
off the "-O coff" and just specify the -F flag and value. Good luck.
..mark
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: Can't link .res file (from windres) using i686-pc-mingw32-g++
2016-02-25 4:29 ` Mark Geisert
@ 2016-02-25 5:18 ` Tony Kelman
2016-02-25 14:50 ` Jim Reisert AD1C
1 sibling, 0 replies; 4+ messages in thread
From: Tony Kelman @ 2016-02-25 5:18 UTC (permalink / raw)
To: Mark Geisert, cygwin
> Jim Reisert AD1C wrote:
>> I have a 64-bit Cygwin environment. I'm trying to compile a 32-bit
>> (target) Windows program using i686-pc-mingw32-g++
>>
>> # i686-pc-mingw32-g++ -g -Wall -Iinclude -I../../library/include -c
>> -o NPOTAdlg.o NPOTAdlg.cpp
>> # windres -Iinclude res/NPOTAdlg.rc -O coff -o res/NPOTAdlg.res
>> # i686-pc-mingw32-g++ -s -mwindows -static-libgcc -static-libstdc++
>> -lwininet NPOTA.o NPOTAdlg.o res/NPOTAdlg.res ../../library/library.a
>> /usr/i686-pc-mingw32/sys-root/mingw/lib/libwininet.a -o NPOTA
Or use i686-pc-mingw32-windres? If that doesn't exist, I know there is
one in mingw-w64 under the name i686-w64-mingw32-windres.
-Tony
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Can't link .res file (from windres) using i686-pc-mingw32-g++
2016-02-25 4:29 ` Mark Geisert
2016-02-25 5:18 ` Tony Kelman
@ 2016-02-25 14:50 ` Jim Reisert AD1C
1 sibling, 0 replies; 4+ messages in thread
From: Jim Reisert AD1C @ 2016-02-25 14:50 UTC (permalink / raw)
To: cygwin
On Wed, Feb 24, 2016 at 9:29 PM, Mark Geisert wrote:
> Just a guess: your 64-bit windres is generating a 64-bit .res file that the
> 32-bit g++ can't grok. Look at 'windres -h'. There's a "-F" == "--target"
> flag that can specify a target type. I would try adding "-F pe-i386" after
> the "-O coff" on your command. If windres doesn't accept both -O and -F,
> try leaving off the "-O coff" and just specify the -F flag and value.
Thanks, Mark, that worked! I assumed that -O coff would "do the right
thing" by itself. I did not realize that "format" and "target" were
independent. I finally read somewhere that by default, windres picks
the target that is listed first when getting help via "-h". In my
case that was pe-x86-64, which was wrong for what I wanted to do.
- Jim
--
Jim Reisert AD1C, <jjreisert@alum.mit.edu>, http://www.ad1c.us
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-02-25 14:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-25 3:57 Can't link .res file (from windres) using i686-pc-mingw32-g++ Jim Reisert AD1C
2016-02-25 4:29 ` Mark Geisert
2016-02-25 5:18 ` Tony Kelman
2016-02-25 14:50 ` Jim Reisert AD1C
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).