在Visual Studio 2012中使用nmake qpOASES

时间:2015-01-04 14:28:23

标签: nmake

我正在尝试在Visual Studio 2012中使用nmake。称我为此错误U1001:语法错误:宏中的非法字符'{'停止。

我的命令是“nmake make.mk”。我的错误在哪里?

感谢您的回复

图书馆是qpOASES 3.1 文件“make.mk”的内容是:

##  This file is part of qpOASES.
##
##  qpOASES -- An Implementation of the Online Active Set Strategy.
##  Copyright (C) 2007-2014 by Hans Joachim Ferreau, Andreas Potschka,
##  Christian Kirches et al. All rights reserved.
##
##  qpOASES is free software; you can redistribute it and/or
##  modify it under the terms of the GNU Lesser General Public
##  License as published by the Free Software Foundation; either
##  version 2.1 of the License, or (at your option) any later version.
##
##  qpOASES is distributed in the hope that it will be useful,
##  but WITHOUT ANY WARRANTY; without even the implied warranty of
##  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
##  See the GNU Lesser General Public License for more details.
##
##  You should have received a copy of the GNU Lesser General Public
##  License along with qpOASES; if not, write to the Free Software
##  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
##



##
##  Filename:  make.mk
##  Author:    Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
##  Version:   3.0
##  Date:      2007-2014
##


TOP = $(realpath $(dir $(lastword $(MAKEFILE_LIST))))

#include ${TOP}/make_linux.mk
#include ${TOP}/make_cygwin.mk
include ${TOP}/make_windows.mk
#include ${TOP}/make_osx.mk

make_windows:

##
##  This file is part of qpOASES.
##
##  qpOASES -- An Implementation of the Online Active Set Strategy.
##  Copyright (C) 2007-2014 by Hans Joachim Ferreau, Andreas Potschka,
##  Christian Kirches et al. All rights reserved.
##
##  qpOASES is free software; you can redistribute it and/or
##  modify it under the terms of the GNU Lesser General Public
##  License as published by the Free Software Foundation; either
##  version 2.1 of the License, or (at your option) any later version.
##
##  qpOASES is distributed in the hope that it will be useful,
##  but WITHOUT ANY WARRANTY; without even the implied warranty of
##  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
##  See the GNU Lesser General Public License for more details.
##
##  You should have received a copy of the GNU Lesser General Public
##  License along with qpOASES; if not, write to the Free Software
##  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
##



##
##  Filename:  make_windows.mk
##  Author:    Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
##  Version:   3.0
##  Date:      2007-2014
##


##
##  definitions for compiling with Visual Studio under Windows
##


################################################################################
# user configuration

# include directories, relative
IDIR =   ${TOP}/include
SRCDIR = ${TOP}/src
BINDIR = ${TOP}/bin

# Matlab include directory (ADAPT TO YOUR LOCAL SETTINGS!)
#MATLAB_IDIR   = ${HOME}/Programs/matlab/extern/include/
MATLAB_IDIR = /usr/local/matlab/extern/include/
MATLAB_LIBDIR = /usr/local/matlab/bin/glnxa64/


# system or replacement BLAS/LAPACK
REPLACE_LINALG = 1

ifeq ($(REPLACE_LINALG), 1)
    LIB_BLAS =   ${SRCDIR}/BLASReplacement.o
    LIB_LAPACK = ${SRCDIR}/LAPACKReplacement.o
else
    LIB_BLAS =   /usr/lib/libblas.so
    LIB_LAPACK = /usr/lib/liblapack.so
endif


################################################################################
# do not touch this

CPP = cl
AR  = ar
RM  = rm
F77 = gfortran
ECHO = echo
CD = cd
CP = copy

# file extensions
OBJEXT = obj
LIBEXT = lib
DLLEXT = so
EXE = .exe
MEXOCTEXT = mex
DEF_TARGET = 
SHARED = /LD

# 32 or 64 depending on target platform
BITS = $(shell getconf LONG_BIT)

# decide on MEX interface extension
ifeq ($(BITS), 32)
    MEXEXT = mexglx
else
    MEXEXT = mexa64
endif

CPPFLAGS = -nologo -EHsc -DWIN32 -Dsnprintf=_snprintf
#-g -D__DEBUG__ -D__NO_COPYRIGHT__ -D__SUPPRESSANYOUTPUT__

FFLAGS = -Wall -O3 -fPIC -DWIN32 -Wno-uninitialized
#        -g

# libraries to link against when building qpOASES .so files
LINK_LIBRARIES = ${LIB_LAPACK} ${LIB_BLAS}
LINK_LIBRARIES_AW = ${LIB_LAPACK} ${LIB_BLAS} -lm -lgfortran -lhsl_ma57 -lfakemetis

# how to link against the qpOASES shared library
QPOASES_LINK = /I${BINDIR} /WL /link ${BINDIR}/libqpOASES.lib
QPOASES_AW_LINK = /I${BINDIR} /WL /link ${BINDIR}/libqpOASES_aw.lib

# link dependencies when creating executables
LINK_DEPENDS = ${LIB_LAPACK} ${LIB_BLAS} ${BINDIR}/libqpOASES.${LIBEXT} ${BINDIR}/libqpOASES.${DLLEXT}


##
##  end of file
##

2 个答案:

答案 0 :(得分:0)

文件make.mk适用于linux。文件make_windows.mk(正如它在其中的注释中所述)是针对使用Visual Studio的Windows。

您可以使用以下命令调用nmake以使用正确的makefile:

nmake /f make_windows.mk

在文档中没有解释这个吗?

答案 1 :(得分:0)

如手册中所述:

  • make_linux.mk,默认选择,用于在Linux下编译,
  • make_cygwin.mk用于在Windows下使用Cygwin进行编译,
  • make_windows.mk用于在Windows下使用Microsoft Visual进行编译 工作室,
  • make_osx.mk用于在Mac OS X下进行编译。