fatal error LNK1181: cannot open input file '.\Debug\myFile.obj

Hi all,

I’ve been working on a CUDA project for a while now…working in MSVS with no problems, building, editing, building again, running, editing, building, etc. For months…no problems.

Today, all of a sudden, I get this error when i try to build today:
LINK : fatal error LNK1181: cannot open input file '.\Debug\myFile.obj

Now I can’t build the file at all. What happened and how do I fix this? I remember when it happened i was building changing one or two TINY things in my code and then within seconds building again. This happened two or three times. And then, on the last attempt at buliding, this error popped up.

Could it be something I hit accidentally?

I found another thread briefly discussing this and someone suggested to try to right click on the actual .cu file and compile it. I did this. but when I try to run the program, it says the solution needs to be built, which then brings about the same error.

Any ideas?

Please advise.

Thanks.

Hi,
Try a rebuild of the project or delete all binaries manually and then recompile.

eyal

Sounds like an intermediate file got corrupted somewhere. Happens from time to time.

To fix it, do Build->Clean Solution

That’ll clear out all the binary stuff, so you can do a fresh rebuild.

Thanks for the replies.

I had already tried cleaning the solution b4 posting. I cleaned, rebooted, tryed again…same error.

What’s weird is that when i compile ONLY the .cu file by right clicking on that file and clicking compile, it does successfully compile that file. In doing so, shouldn’t an obj file be created from that file?

Cause when I go to check the directory where it expects to see this file, C:\ProgramData\NVIDIA Corporation\NVIDIA CUDA SDK\bin\win32\Debug, that file is not found.

Any ideas?

This seems crazy.

Try to check the output of the obj file, maybe you have a typo there or deleted something by accident.

Can you post the custom command line you use to compile this .cu file?

There’s no craziness :) just something you overlook in the configuration :)

eyal

Just so you know, since i was (and still am) new at this, I took the advice on a previous thread and simply copied the template project/solution and used it to make my simulator.

As a result, my project has three items in it: mySimulator.cu, template_gold.cpp, and template_kernel.cu. Those last two files are from the template project and really don’t need to be there (I think)…because my kernel is actually just coded into the same file as the rest of my program…into mySimulator.cu. But I’ve never deleted those other two files cause i wasn’t sure if that would mess something up. So that is a side question, can I delete those files, KNOWING that this was originally copied from the template solution, and knowing that in my main mySimulator.cu (which was previously template.cu), I deleted any and all references to the other two files.

Okay, to answer your question…

When you say command line arguments, since I’m using MSVS 2008, I guess you mean the “command line” stuff seen when i click the .cu file and click on properties. When I do this, I come to configuration properties, one of which is the command line property, which has this:

"$(CUDA_BIN_PATH)\nvcc.exe" -ccbin "$(VCInstallDir)bin" -c -D_DEBUG -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Wp64,/Od,/Zi,/RTC1,/MTd -I"$(CUDA_INC_PATH)" -I./ -I../../common/inc -o $(ConfigurationName)\$(InputName).obj $(InputFileName)

Again, that is the command line specifically for the mySimulator.cu file. And to be honest, i’m not sure what all that is trying to say. But again, it is the command line from the template file. I’ve never changed it.

You said check the output of the .obj file. How do I do that? Again, i can’t build the solution. However, as mentioned, I can right click on JUST the mySimulator.cu file and compile it. And when doing so, shouldn’t it create an obj file? But i can’t locate it.

Anyway, hopefully this gives you something to work with to help formulate what i’m doing wrong.

Thanks.

Do you have a file named myFile.cu or myFile.c/cpp?

I DO have a file called mySimulator.cu. To get this file and it’s command line arguemnts, I simply renamed the template.cu file and changed it’s contents.

For the purposes of my cuda program (mySimulator.cu), it is all enclusive…the kernel is also coded inside this one .cu file.

However, as mentioned, the template_gold.cpp is still part of the project, along with the template_kernel, because those two files were originally part of the template solution.

Is that somehow related?

Sorry, I should have been a little bit more clear…

From what I see in my projects, I have two source files inside of ‘My Documents\SVM_Project\SVM\SVM_BlockPerTestPt’:

SVMClassify_kernels.cu

SVMClassify.cpp

When I right click on the cu file and select compile, I get SVMClassify_kernels.obj output file in ‘My Documents\SVM_Project\SVM\SVM_BlockPerTestPt\EmuDebug’:

The fact that you are getting an error looking for ‘myFile.obj’ suggests to me that your linker is looking for a compiled myFile.cu/cpp/c file. If this doesn’t exist anywhere, I don’t know why it would be looking for this.

Could you have somehow added the dependency for the project?

Does a Release build work for you?

Are you using the CUDA VS Wizard? If not, I would suggest looking into it…

Well basicaly you should get a better knowledge of the files, compilation flags, VS settings it will only help :)

Second you’d better remove the files you dont need from the project.

And third maybe post here the project in its simplest form and we might be able to reproduce the problem (if its persistent)

and figure out where is the problem in the configuration .

eyal