*** missing separator (did you mean TAB instead of 8 spaces?)或者*** missing separator的解决办法

最近在学习NDK的时候,使用到SWIG工具的时候,将SWIG集成到Android构建过程中的时候,构建了一个my-swig-generate.mk的Makefile文件,代码如下:

#
#Android构建系统的SWIG扩展
#

#检查变量 MY_SWIG_PACKAGE 是否已经定义
ifndef MY_SWIG_PACKAGE
  $(error MY_SWIG_PACKAGE is not defined.)
endif

#用斜线替换java目录中的圆点
MY_SWIG_OUTDIR:= $(NDK_PROJECT_PATH)/src/$(subst .,/,$(MY_SWIG_PACKAGE))
#SWIG的默认类型是C
ifndef MY_SWIG_TYPE
  MY_SWIG_TYPE := c
endif

#设置SWIG模式
ifeq ($(MY_SWIG_TYPE),cxx)
  MY_SWIG_MODE := -c++
else
  MY_SWIG_MODE := 
endif

#追加SWIG封装源文件
LOCAL_SRC_FILES += $(foreach MY_SWIG_INTERFACE,\
  $(MY_SWIG_INTERFACES),\
  $(basename $(MY_SWIG_INTERFACE))_wrap.$(MY_SWIG_TYPE))
 
 #添加.cxx作为c++扩展名
 LOCAL_CPP_EXTENSION += .cxx
 
 #生成SWIG封闭代码(indention should be tabs for this block)
 %_wrap.$(MY_SWIG_TYPE) : %.i
    $(call host-mkdir,$(MY_SWIG_OUTDIR))
	swig -java \
	$(MY_SWIG_MODE) \
	-package $(MY_SWIG_PACKAGE) \
	-outdir $(MY_SWIG_OUTDIR) \
	$<


然后将SWIG集成到Android.mk文件:

# Copyright (C) 2009 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := hello-jni
LOCAL_SRC_FILES := hello-jni.c

MY_SWIG_PACKAGE := com.apress.swig
MY_SWIG_INTERFACES := Unix.i
MY_SWIG_TYPE := c

include $(LOCAL_PATH)/my-swig-generate.mk

include $(BUILD_SHARED_LIBRARY)


选中项目,在主菜单选择Project | Build All来重新构建当前的Android项目时,出现了 “*** missing separator.  Stop.”这个错误:错误如下图所示:

*** missing separator (did you mean TAB instead of 8 spaces?)或者*** missing separator的解决办法_第1张图片


这个错误是由于我在编写这个文件的时候,34行前面用的是空格,而不是tab,所以造成了操作符丢失的错误。


解决办法是:把缩进的空格delete掉,然后按tab键用tab代替4个空格。(ps: 下面的35、36、37、38、39也要用tab,不要用空格,不然还是会报错,而且错误居然定位到了34行)




你可能感兴趣的:(ndk,***,missing,separator,笔记)