[ILINK32 Error] Fatal: Unable to open file .obj
2012-07-16 16:59
483 查看
If you have been playing around with Delphi packages compiled for C++ Builder in Borland Developer Studio or CodeGear RAD Studio, you'll have undoubtedly run into this error message. You could also run into that if you are not dealing
with Delphi packages (e.g. using a run-time package, static library).
Let's start with Delphi packages.
What is suspicious is the way the linker reports the error - such as [ILINK32 Error] Fatal: Unable to open file MyComponent.obj. You search the entire hard drive for MyComponent.obj only to find the closest thing to be MyComponent.dcu, which is compiled in
Delphi from MyComponent.pas. So how and where do you get MyComponent.obj?
The answer is, this .obj file is actually in a container with the extension of .LIB. If your package with MyComponent.pas is called MyPackage.bpl, then you need to look for MyPackage.lib. While an installed package should get automatically added to the default
list of included packages when you create a new project file, it doesn't always happen (i.e. bug). All you have to do then is manually open up your current project file (.cbproj) in a text editor and add MyPackage.lib into the tag. Reload your project and
you should be able to link successfully.
If you are not dealing with Delphi packages and you get that error message, that means you're trying to use a static library, or a run-time package (and some times even design-time package which are not dropped onto a form / data module). This could easily
be fixed and is the expected way linkers work. There are 2 ways you can fix this:
1) Add the lib file to the project (I don't like this, as you rely on the user of the static library to remember to add the lib file every time they use it in a new project)
2) Add the following line to a header file which is guaranteed to be included when the static library is used:
#pragma comment(lib, "your library name.lib")
That's it.
I haven't tried C++ Builder 2009, but I hope CodeGear have found a better way to do this. Actually, I'd suggest that they simply make all Delphi compiler generated C++ Builder files include that #pragma comment(lib, ...) line
so that we never have to muck around with the .cbproj files any more. In fact, this would also mean that there will be no annoying messages that prompts you to remove packages you don't need when you create and try to save a new project.
附注:有的时候.obj包含在另外一个.lib文件中(即.obj文件的文件名与.lib文件的文件名不一致)
如果添加了.lib文件后,依然报这种错误,可能是由于.lib文件所在的路径没有加入到工程中!
原文链接:http://zachsaw.blogspot.com/2008/10/ilink32-error-fatal-unable-to-open-file.html
with Delphi packages (e.g. using a run-time package, static library).
Let's start with Delphi packages.
What is suspicious is the way the linker reports the error - such as [ILINK32 Error] Fatal: Unable to open file MyComponent.obj. You search the entire hard drive for MyComponent.obj only to find the closest thing to be MyComponent.dcu, which is compiled in
Delphi from MyComponent.pas. So how and where do you get MyComponent.obj?
The answer is, this .obj file is actually in a container with the extension of .LIB. If your package with MyComponent.pas is called MyPackage.bpl, then you need to look for MyPackage.lib. While an installed package should get automatically added to the default
list of included packages when you create a new project file, it doesn't always happen (i.e. bug). All you have to do then is manually open up your current project file (.cbproj) in a text editor and add MyPackage.lib into the tag. Reload your project and
you should be able to link successfully.
If you are not dealing with Delphi packages and you get that error message, that means you're trying to use a static library, or a run-time package (and some times even design-time package which are not dropped onto a form / data module). This could easily
be fixed and is the expected way linkers work. There are 2 ways you can fix this:
1) Add the lib file to the project (I don't like this, as you rely on the user of the static library to remember to add the lib file every time they use it in a new project)
2) Add the following line to a header file which is guaranteed to be included when the static library is used:
#pragma comment(lib, "your library name.lib")
That's it.
I haven't tried C++ Builder 2009, but I hope CodeGear have found a better way to do this. Actually, I'd suggest that they simply make all Delphi compiler generated C++ Builder files include that #pragma comment(lib, ...) line
so that we never have to muck around with the .cbproj files any more. In fact, this would also mean that there will be no annoying messages that prompts you to remove packages you don't need when you create and try to save a new project.
附注:有的时候.obj包含在另外一个.lib文件中(即.obj文件的文件名与.lib文件的文件名不一致)
如果添加了.lib文件后,依然报这种错误,可能是由于.lib文件所在的路径没有加入到工程中!
原文链接:http://zachsaw.blogspot.com/2008/10/ilink32-error-fatal-unable-to-open-file.html
相关文章推荐
- c++builder 2010 [ILINK32 Error] Fatal: Unable to open file 'xxxxxx.OBJ'
- [ilink32 Error] Fatal: Unable to open file 'EUREKALOGCORE.LIB'
- BCB error:Fatal: Unable to open file 'DCLUSR.LIB',E2209 Unable to open include file 'SUIForm.hpp'
- linker error: unable to open input file 'coh.obj'错误的排除
- Error: Unable to open class file R.java
- ORA-07391: sftopn: fopen error, unable to open text file
- ORA-15025: could not open disk"...." ORA-27041: unable to open file Linux-x86_64 Error: 13: Permiss
- Unable to open the physical file xxxx. Operating system error 2
- 解决:Unable to open the physical file "…….ldf". Operating system error 5: "5(拒绝访问。)".
- nasm:fatal:unable to open output file
- sqlite3.OperationalError: unable to open database file
- Ubuntu+django+apache下配置网页错误OperationalError: Unable to Open Database File 的解决方法
- 使用XCode6打开项目以后再用XCode5出现的问题fatal error: malformed or corrupted AST file: 'Unable to load module
- [置顶] OGG-01091 Unable to open file (error 89, Invalid file system control data detected)
- ERROR: Unable to open class file R.java
- Error: unable to open database "BookStore.db": unable to open database file
- fatal error: malformed or corrupted AST file: 'Unable to load module Darwin.pcm 问题解决
- Jenkins自动化打包遇到的问题abc_list_focused_holo.9.png ERROR: Unable to open PNG file
- Unable to open the physical file "d:\***.mdf". Operating system error 5: "5(Access is denied.)".
- Flask sqlite3.OperationalError: unable to open database file解决方法