main.obj : fatal error LNK1143: invalid or corrupt

2019-08-13 01:46发布

问题:

I am on a Windows 10 machine, I have 2 files, main.cpp and cuda.cu (I have built this project on Ubuntu successfully I am trying to get it to build on Windows). I compiled both of them to make object files of 64 bit architecture. I have MS Visual Studio 2010 currently installed and I know it is too old. I can install 2015 if you think that is causing this (but I don't think so).

When I try to link the two files using the command

nvcc main.obj cuda.obj

I get this error:-

main.obj : fatal error LNK1143: invalid or corrupt file: no symbol for COMDAT section 0x6

What should I do?

回答1:

As pointed out by @RichardCritten,

the files should be compiled with MSVC as the object formats are tool-chain specific. LNK1143 is from the MS linker and it can't understand the format of the obj files produced by the other tool-chain.

So object files created by MinGW's g++ can't be linked with a cuda program's object file with MSVC



标签: c++ cuda g++ nvcc