Author Topic: Linking .res file (in .dll)  (Read 11099 times)

download123

  • Guest
Linking .res file (in .dll)
« on: August 28, 2006, 03:10:47 pm »
I tryed to work with an .res file and to link it in the projekt but there is trubel with it.
I first tryed to simply add the opt.res to the projekt and compile it...

then i get the errors:

Code
Compiling: main.cpp
Linking dynamic library: Miranda.dll
mingw32-g++.exe: .objs\opt.o: No such file or directory
Process terminated with status 1 (0 minutes, 2 seconds)

whats wrong?

Offline Defender

  • Multiple posting newcomer
  • *
  • Posts: 49
Re: Linking .res file (in .dll)
« Reply #1 on: August 28, 2006, 03:19:33 pm »
Hello!
I'm glad, you mentioned this, because this is annoying me since 2 days.
If you add *.def file to the project (in my case), C::B still wants to create a *.o file from it, even if you unchecked the "Compile" option.
At link time it still wants to find the *.o file.

-- The only solution I know is, to remove the file from the project, and add a line to the linker options dialog, that makes it link.

Defender

download123

  • Guest
Re: Linking .res file (in .dll)
« Reply #2 on: August 28, 2006, 03:32:26 pm »
add a line to the linker options dialog, that makes it link.

Defender

can you give an exampel for this?

Offline Defender

  • Multiple posting newcomer
  • *
  • Posts: 49
Re: Linking .res file (in .dll)
« Reply #3 on: August 28, 2006, 04:11:34 pm »
add a line to the linker options dialog, that makes it link.

Defender

can you give an exampel for this?
Yup, try like this:
Remember to remove the file from the project OR uncheck both Compile and Link

[attachment deleted by admin]

download123

  • Guest
Re: Linking .res file (in .dll)
« Reply #4 on: August 28, 2006, 04:35:47 pm »
if i try it like that

Linking dynamic library: Miranda.dll
.\opt.res: file not recognized: File format not recognized
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 2 seconds)

bzw.
Linking dynamic library: Miranda.dll
opt.res: file not recognized: File format not recognized
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
« Last Edit: August 28, 2006, 04:38:55 pm by download123 »

Offline Defender

  • Multiple posting newcomer
  • *
  • Posts: 49
Re: Linking .res file (in .dll)
« Reply #5 on: August 28, 2006, 04:46:37 pm »
Hmm...

Are you sure, that the *.res file is correct? This message means, that the linker finds the file correctly, but it cannot recognize the content.

How is this opt.res built?

download123

  • Guest
Re: Linking .res file (in .dll)
« Reply #6 on: August 28, 2006, 05:01:39 pm »
It's build with an res editor
[XN Resource Editor]

[http://www.mytempdir.com/893134 there is an upload of it]

Offline kkez

  • Almost regular
  • **
  • Posts: 153
    • WinapiZone
Re: Linking .res file (in .dll)
« Reply #7 on: August 28, 2006, 05:48:47 pm »
I was able to open your .res file with the Visual C++ resource editor, while i wasn't when i tried one of my res files that windres outputs when compiling a .rc file. Two different files from two different compilers, just like the object files from mingw and microsoft's compiler. So you have two options:
1) compile your project and the res file with the microsoft compiler
2) save your resources in a .rc file (from the resource editor) and compile it with the mingw's windres.

EDIT: Well, Visual C++ can do the job for you (the res 2 rc "translation").
The rc file is attached, just add it to your project and compile, although i don't think that windres will compile all that mess that microsoft add to the .rc file. Remove it if it complains, it's useless. Of course you need to remove the .txt extension.

EDIT: in 3 kb of file the only useful thing is:
Code
#include "resource.h"
#include <windows.h>

1 DIALOG /*FIXED IMPURE (impure? lol)*/ 0, 0, 186, 95
STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION |
    WS_SYSMENU
EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE
FONT 8, "MS Shell Dlg"
BEGIN
    CONTROL         "Welcome Message",1,"Button",BS_AUTOCHECKBOX |
                    WS_TABSTOP,5,16,76,14,WS_EX_NOPARENTNOTIFY
    CONTROL         "Goodbye Message",2,"Button",BS_AUTOCHECKBOX |
                    WS_DISABLED | WS_TABSTOP,5,36,76,14,WS_EX_NOPARENTNOTIFY
    CONTROL         "Show only on next Start",3,"Button",BS_AUTOCHECKBOX |
                    WS_TABSTOP,5,56,100,17,WS_EX_NOPARENTNOTIFY
    PUSHBUTTON      "Reset",4,127,57,50,14,0,WS_EX_NOPARENTNOTIFY
END

EDIT: ciao :)

[attachment deleted by admin]
« Last Edit: August 28, 2006, 06:01:57 pm by kkez »

download123

  • Guest
Re: Linking .res file (in .dll)
« Reply #8 on: August 28, 2006, 06:05:26 pm »
oh well thank you..

so it was my fault...

in this fact there is an other question :
Is there any free resource creator that creates directly the .rc and .h
*withour VC++*

« Last Edit: August 28, 2006, 06:09:50 pm by download123 »