when trying to use new clang with Visual Codegen in my project (Visual Studio 2015 Update 1), I'm getting following error:
clang.exe : error : cannot specify -o when generating multiple output files
This is just a newly created project with autogenerated main.
I really don't know what to do about it.
Any help appreciated.
It is not very clear what you are doing but it seems obvious that you are not using one of the Clang project templates in the Cross Platform node. I can repro your problem by using the Win32 > Win32 Project template and changing the project's Platform Toolset selection to "Clang 3.7".
That doesn't work, it completely flubs the precompiled header feature. It is somehow convinced that it needs to compile stdafx.h. Not just once, it passes it the compiler twice. Which makes Clang barf with this error message, it will only accept one file at a time. It also doesn't know how to take advantage of Clang's PCH support, no sign of the required -emit-pch option.
You'll need to get ahead by turning the feature off. Project > Properties > C/C++ > Precompiled Headers > Precompiled Header = "Not using...". Select stdafx.cpp and repeat.
That solves the build problem, the final executable somewhat surprising runs without issue. It should be somewhat clear that you are using Clang in a scenario that was never tested by Microsoft. Looks like the IntelliSense parser is going to need a lot more work as well. Afaik Clang support was intended to target Android and iOS, current version is alpha quality.
Just as an addition to the accepted answer, if you are still experiencing this issue even after setting Precompiled Header = "Not using..."
. The other issue might be an incorrect value in the Object File Name
field.
That field can be found under: Project > Properties > C/C++ > General > Object File Name = $(IntDir)%(filename).obj
Note: originally discover this solution here: http://www.progtown.com/topic2009949-clang