Visual Studio 2015 Update 1, clang error

when I try to use the new clang with Visual Codegen in my project (Visual Studio 2015 Update 1), I get the following error:

clang.exe : error : cannot specify -o when generating multiple output files 

This is a newly created project with an auto-generated core.

I really don't know what to do with this.

Any help was appreciated.

+5
source share
2 answers

It’s not entirely 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 reproduce your problem using the Win32> Win32 project template and changing the Platform Toolset platform selection to "Clang 3.7".

This does not work; it completely overrides the precompiled header function. It is somehow convinced that he needs to compile stdafx.h. More than once, it passes it to the compiler twice. What Clang barf does with this error message, it will only accept one file at a time. He also does not know how to use Clang PCH support, no sign of the required -emit-pch option.

You will need to advance by turning this feature off. Project> Properties> C / C ++> Precompiled Headers> Precompiled Header = "Do Not Use ...". Select stdafx.cpp and retry.

This is a solution to the build problem, the final executable unexpectedly works without problems. It should be somewhat clear that you are using Clang in a scenario that Microsoft has never tested. It looks like the IntelliSense parser will need a lot more work. Support for Afaik Clang was designed for target Android and iOS, the current version is alpha quality.

+6
source

As an addition to the accepted answer, if you are still experiencing this problem even after setting Precompiled Header = "Not using..." . Another question may be the wrong value in the Object File Name field.

This field can be found in: Project> Properties> C / C ++> General> Object File Name = $(IntDir)%(filename).obj

Note: initially find this solution here: http://www.progtown.com/topic2009949-clang

+1
source

Source: https://habr.com/ru/post/1237161/


All Articles