nmake fatal error U1034: syntax error : separator missing

落花浮王杯 提交于 2019-12-02 16:38:23

问题


# gnsdk C# wrapper sample makefile
##

CC=Csc.exe
CP=cp

GNSDK_LIB_PATH=../../../../lib/$(GNSDK_PLATFORM)
GNSDK_WRAPPER_LIB_PATH=../../lib/$(GNSDK_PLATFORM)
GNSDK_MARSHAL_LIB=$(GNSDK_WRAPPER_LIB_PATH)/gnsdk_csharp_marshal.dll
GNSDK_CSHARP_LIB=../../lib/gnsdk_csharp.dll


CSHARP_FLAGS=/noconfig /nowarn:1701,1702 /nostdlib+ /errorendlocation
CSHARP_REFS=/reference:$(GNSDK_CSHARP_LIB) /reference:"Microsoft.CSharp.dll" /reference:"mscorlib.dll" /reference:"System.Core.dll" /reference:"System.Data.DataSetExtensions.dll" /reference:"System.Data.dll" /reference:"System.dll" /reference:"System.Xml.dll" 

ifeq ($(GNSDK_PLATFORM), win_x86-32)
    CSHARP_FLAGS+=/platform:x86
endif

ifeq ($(GNSDK_PLATFORM), win_x86-64)
    CSHARP_FLAGS+=/platform:x64
endif

SAMPLE_TARGET=sample.exe


build_sample:
    $(CC) $(CSHARP_FLAGS) $(CSHARP_REFS) /out:$(SAMPLE_TARGET) /target:exe /utf8output MusicIDStream.cs
    $(CP) $(GNSDK_MARSHAL_LIB) .
    $(CP) $(GNSDK_CSHARP_LIB) .

I got a makefile for a c# application. I am trying to run it from visual studio command prompt. I got error with this row: CSHARP_FLAGS+=/platform:x86


回答1:


The makefile you are looking at appears to be a GNU make makefile. You cannot use it with nmake. You'll have to install GNU make if you want to use this makefile, or else write an nmake makefile to use with nmake.




回答2:


The separator missing refers to the fact that nmake is missing a colon between a target and its dependents.

In this case this is caused by the use of the GNU make ifeq, which NMAKE doesn't recognize and interprets as a target. Use the if-clause of NMAKE.

So replace your if-clauses with the following:

!if "$(GNSDK_PLATFORM)" == "win_x86-32"
CSHARP_FLAGS+=/platform:x86
!endif

!if "$(GNSDK_PLATFORM)" == "win_x86-64"
CSHARP_FLAGS+=/platform:x64
!endif

Note the ! mark before the if and endif clause and also the lack of additional line spaces. These are important.



来源:https://stackoverflow.com/questions/38466527/nmake-fatal-error-u1034-syntax-error-separator-missing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!