I'm compiling own project. And it halted by this error:
LINK||fatal error LNK1181: cannot open input file 'obj\win\release\src\lua\bindings.o'|
Compiling using Code::Blocks with VS 2005/2008 compiler under win7. There are also lot of another empty directories where *.o files are missing.
What do they do?
A .o object file file (also . obj on Windows) contains compiled object code (that is, machine code produced by your C or C++ compiler), together with the names of the functions and other objects the file contains. Object files are processed by the linker to produce the final executable.
An O file is a compiled C program object. Some C compilers create O files during the executable (. EXE) creation process. O files themselves are typically not executable. When compiling a C program, compilers first transform all the program's source code files into compiled object files.
The best way to open an O file is to simply double-click it and let the default assoisated application open the file. If you are unable to open the file this way, it may be because you do not have the correct application associated with the extension to view or edit the O file.
A file ending in .o is an object file. The compiler creates an object file for each source file, before linking them together, into the final executable.
You've gotten some answers, and most of them are correct, but miss what (I think) is probably the point here.
My guess is that you have a makefile you're trying to use to create an executable. In case you're not familiar with them, makefiles list dependencies between files. For a really simple case, it might have something like:
myprogram.exe: myprogram.o $(CC) -o myprogram.exe myprogram.o myprogram.o: myprogram.cpp $(CC) -c myprogram.cpp
The first line says that myprogram.exe
depends on myprogram.o
. The second line tells how to create myprogram.exe
from myprogram.o
. The third and fourth lines say myprogram.o
depends on myprogram.cpp
, and how to create myprogram.o
from myprogram.cpp` respectively.
My guess is that in your case, you have a makefile like the one above that was created for gcc. The problem you're running into is that you're using it with MS VC instead of gcc. As it happens, MS VC uses ".obj" as the extension for its object files instead of ".o".
That means when make (or its equivalent built into the IDE in your case) tries to build the program, it looks at those lines to try to figure out how to build myprogram.exe
. To do that, it sees that it needs to build myprogram.o
, so it looks for the rule that tells it how to build myprogram.o
. That says it should compile the .cpp file, so it does that.
Then things break down -- the VC++ compiler produces myprogram.obj
instead of myprogram.o
as the object file, so when it tries to go to the next step to produce myprogram.exe
from myprogram.o
, it finds that its attempt at creating myprogram.o
simply failed. It did what the rule said to do, but that didn't produce myprogram.o
as promised. It doesn't know what to do, so it quits and give you an error message.
The cure for that specific problem is probably pretty simple: edit the make file so all the object files have an extension of .obj
instead of .o
. There's room for a lot of question whether that will fix everything though -- that may be all you need, or it may simply lead to other (probably more difficult) problems.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With