Page 1 of 2

[Linker Fatal Error] Fatal: Unable to open file 'WINDOWS.OBJ

Posted: Wed Sep 01, 2004 10:49 am
by shadowstar
C++Builder 6
Uncheck Build with rumtime packages.

Posted: Wed Sep 01, 2004 11:07 am
by shadowstar

Code: Select all

#include <madCodeHook.hpp>
#include <madRemote.hpp>

#pragma comment(lib, "madCodeHook_.lib")
#pragma comment(lib, "madRemote_.lib")

...

Posted: Thu Sep 02, 2004 11:01 am
by madshi
You don't need the pragma links. Using that #include is enough. Does the problem still occur when using #include only?

Posted: Thu Sep 02, 2004 2:40 pm
by shadowstar
madshi wrote:You don't need the pragma links. Using that #include is enough. Does the problem still occur when using #include only?
yes.

I find text "WINDOWS.OBJ" in file madCodeHook.obj, but can't find file "WINDOWS.OBJ" in any directory. I add $(BCB)\Source\Windows.pas to the project, OK, but another error occured:

Code: Select all

[Linker Fatal Error] Fatal: Unable to open file 'SYSTEM.OBJ'
Add System.pas

Code: Select all

[Pascal Error] pasall.tmp(4): Identifier redeclared: 'system'

Posted: Thu Sep 02, 2004 4:08 pm
by madshi
Very strange. Could you please try with a brand new project? Does the problem occur there, too?

Are you using the BCB evaluation version?

Posted: Fri Sep 03, 2004 4:56 am
by shadowstar
madshi wrote:Very strange. Could you please try with a brand new project? Does the problem occur there, too?

Are you using the BCB evaluation version?
Yes, the problem occur in the brand new project.

I'm using the BCB Enterprise Suite Version 6.0.

Posted: Fri Sep 03, 2004 5:09 am
by shadowstar
madshi wrote:You don't need the pragma links. Using that #include is enough. Does the problem still occur when using #include only?
Oh, when using #include only:

Code: Select all

[Linker Error] Unresolved external '__stdcall Madcodehook::AmSystemProcess()' referenced from D:\PROGRAM FILES\BORLAND\CBUILDER6\PROJECTS\UNIT1.OBJ

Posted: Fri Sep 03, 2004 8:25 am
by madshi
I've tested it again. With runtime packages you don't need the #pragma stuff. But not using runtime packages you need to add this:

#pragma link "madCodeHook.obj"

Posted: Fri Sep 03, 2004 9:21 am
by shadowstar
madshi wrote:I've tested it again. With runtime packages you don't need the #pragma stuff. But not using runtime packages you need to add this:

#pragma link "madCodeHook.obj"

Code: Select all

[Linker Fatal Error] Fatal: Unable to open file 'WINDOWS.OBJ'
Does the problem not occur in your project?

Posted: Fri Sep 03, 2004 9:52 am
by madshi
Which problem do you mean?

Have you noticed that my "pragma" call is different than yours? Please try my pragma call. Using that my BCB5 test project compiles&links just fine.

Posted: Fri Sep 03, 2004 11:43 am
by shadowstar
I have used #pragma comment and #pragme link, the error allways occured.

Sorry, I don't have BCB5, could you test it in BCB6?

Posted: Mon Sep 06, 2004 4:53 pm
by madshi
I'll test it in BCB6 as soon as possible. Right now I don't have access to BCB6, but I should get it soon. For now you can use the madCHook.h file together with the madCHook.dll. It's not as nice as the native Delphi/BCB stuff, but at least it should let you begin working.

Posted: Wed Sep 08, 2004 11:15 am
by shadowstar
Thank you.
:D

Posted: Sun Sep 19, 2004 12:51 pm
by madshi
Finally got BCB6 (enterprise edition) now. Created a new project, added a button to the main form. Double clicked it. Added this to the OnClick event:

Code: Select all

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  AmSystemProcess();
}
Got this error, of course:

[C++ Error] Unit1.cpp(23): E2268 Call to undefined function 'AmSystemProcess'

Added:

Code: Select all

#include <madCodeHook.hpp>
Compiled and linked fine. Unchecked "runtime packages" from the project options. Recompiled. Got the error:

[Linker Error] Unresolved external '__stdcall Madcodehook::AmSystemProcess()' referenced from C:\DESKTOP\BCB6TEST\UNIT1.OBJ

Added:

Code: Select all

#pragma link "madCodeHook"
Compiled, linked and run fine. So I can't see anything wrong.

Here's the final full code:

Code: Select all

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------

#include <madCodeHook.hpp>
#pragma link "madCodeHook"

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  AmSystemProcess();
}
//---------------------------------------------------------------------------

Posted: Sun Sep 19, 2004 12:52 pm
by madshi
Maybe your library path is too long? Delphi/BCB has a hard limit on how long the library/search path may get. If you have too many components/packages installed with too long paths, Delphi/BCB usually can't find system.pas/obj, anymore. Try to clean up/shorten your library path.