linker error: cannot open input file 'er.obj'

I'm trying to link against SDL2 using the VC compiler and the command line interface.

I have a build.bat file which contains the following:
cl "..\src\*.cpp" /Fe"main.exe" "..\lib\SDL2.lib" /linker /SUBSYSTEM:CONSOLE

when i run it i get the following error:
LINK : fatal error LNK1181: cannot open input file 'er.obj'

has anyone ran in to this error before?
does anyone know whats wrong?
I don't know anything about SDL or what you are doing, but in general when you get linker errors such as that it means exactly what it says. In the case above something in your code or included by your code is referencing er.obj, and the build chain doesn't know where it is.
oh haha i figured it out.
you were right, it was trying to link against er.obj because
apparently the linker flag isn't /linker but just /link

sorry about that :)
Last edited on

..apparently the linker flag isn't /linker but just /link

Can't believe I didn't spot that. I do command line builds all the time. Usually one doesn't need the explicit /link switch.
Registered users can post here. Sign in or register to post.