LINK : fatal error LNK1104: cannot open file

I'm hoping someone can help me with this problem. I'm fairly new to c++ but was asked to take on a project where I work. I'm trying to compile and build a program that was originally developed with Visual C++ 6.0. I'm using Visual Studio 2008 with Win7, 64 bit. I was able to convert the project from 6.0 to VS2008 and was able to work through some of the compiler errors. Now I'm stuck on this error, "LINK : fatal error LNK1104: cannot open file '.\Debug\EncoreMacPacReader.obj'".

I was able to determine the compiler is not creating the object files and I have check the properties on the directory where the files are to be written. There are no restrictions in the path to where the compiler should be creating the object files.

I've also checked the precompiled headers and preprocessor options under the Configuration, C/C++ options in the project property. I'm not familiar with all the options here but I did make some changes based on what I've read on this and other C++ forums. Yet I still get the same error. I believe it's something simple as the problem is consistent regardless of the options I change.

Please let me know if anyone can assist. I can provide more detail. However, the project has over 60 files.

Thanks in advance,
mth
This problem can have many reasons.. did you try to "rebuild all".. sometimes the VS6.0 and newest VS program database/intellesense clash and they give errors. rebuilding all sometimes fix these issues. try it.

Edit: another thing you can try is, create a console/win32 project. whatever applies and add all the files to the new project, add c++ and linker settings and any other settings you have and see what happens.
Last edited on
Thanks Sharma,
I have tried cleaning and rebuilding the solution many times.

I also tried the new console project but that generated a ton of errors. I'm not totally sure how the original project was written, I believe it is Microsoft Foundation Class because I see a lot of MFC references in the source code.
If its a MFC application, you would not like to create a console application.

create a new MFC application and just next till finish. it will do some stuff and create some files. remove all the files from the project and also delete them from the file system.

Now, put the files from the old project here and add them. cpp files to source and .h to headers. Now compile. If its a MFC application and you have done most of the things right, I dont think it should give you compilation errors. but it can.

Now, go to the old project settings (the one which is converted from vs 6.0) c++ settings and see what all include paths it has. copy all those to the new project.
same for linker. See what all .lib/dlls it uses and put all those to the new project. The old project will have include paths for libs also (where it needs to look fro libraries), copy those to the new project.

Generally this will fix everything.

Last edited on
Thanks for your assistance but that did not work either. Now I'm getting 'fatal error C1083: Cannot open precompiled header'.

Tried to cut and paste a screen shot, but I'm unable to do so in this forum.

Not sure where to go from here, any other suggestions would be much appreciated.

Thanks
Last edited on
I suggest, you increase some knowledge of your compiler and the language you are working on.

try to find the option in the compiler which says - using precompile header and just click the option - "not using pre compiled header file".

Edit: programming is something where sometimes the solutions looks distant and you may struggle for days and weeks and even months.. so if you want to be a good programmer, be patient and just stick to your goal.. you will get success :-)
Last edited on
Topic archived. No new replies allowed.