skip to Main Content

I am trying to compile a plugin example for a software from autodesk.

here is the Makefile

##############################################################################
#           Makefile for use by API developers                               #
#                                                                            #
#  NOTE: "vcvarsall amd64" must be run before attempting to compile the API  #
#  examples. Please see the API documentation for information.               #
#                                                                            #
##############################################################################

#
# If the location of the Alias libraries and header files are
# different from $ALIAS_LOCATION, set it here.
#
ALIAS_LOCATION=C:Program FilesAutodeskAliasSurface2023.0


CPPEXAMPLES = cppCube.exe

EXAMPLES = $(CPPEXAMPLES)

CC = cl.exe
CPLUSPLUS = cl.exe
LINK = link.exe

INCLUDES = /I. /I"$(ALIAS_LOCATION)ODSCommoninclude" /I"C:Program FilesWindows Kits10Include10.0.22621.0ucrt" /I"C:Program FilesMicrosoft Visual Studio2022BuildToolsVCToolsMSVC14.37.32822include"

# 
# Dynamic Linking.
#
EXTRA_LFLAGS = /LIBPATH:"$(ALIAS_LOCATION)lib";"C:Program Files (x86)Windows Kits10Lib10.0.22621.0umx64" /VERBOSE
EXTRA_CFLAGS = 
LFLAGS = /nologo /SUBSYSTEM:CONSOLE /NODEFAULTLIB:LIBC.LIB $(EXTRA_LFLAGS) /STACK:0xa00000

#
# Required libraries. 
#
LIBS = libalias_api.lib

STD = kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib 
     advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib 
     odbc32.lib odbccp32.lib comctl32.lib netapi32.lib 
     version.lib ws2_32.lib

CLIBS = $(LIBS) $(STD)

CFLAGS = /nologo /MD $(INCLUDES) $(COPIOUS_OUTPUT) $(EXTRA_CFLAGS)
CPLUSPLUSFLAGS = $(CFLAGS)

#
# Rules for building.
#
.SUFFIXES: .c .c++ .obj .cpp

.cpp.obj:
    $(CPLUSPLUS) -c $(CPLUSPLUSFLAGS) $*.cpp

.c.obj:
    $(CC) -c $(CFLAGS) $*.c

#
# Build all the examples.
#
default: $(EXAMPLES)

#
# Copy all the source files for the examples.
#
copy:
    copy "$(ALIAS_LOCATION)ODSOpenModelexamples*.cpp" .
    copy "$(ALIAS_LOCATION)ODSOpenModelexamples*.c" .
    copy "$(ALIAS_LOCATION)ODSCommonexamples*.cpp" .
    copy "$(ALIAS_LOCATION)ODSCommonexamples*.c" .
    copy "$(ALIAS_LOCATION)ODSCommonexamples*.h" .

#
# Clean up.
#
clean:
    del *.obj *.exp *.lib $(EXAMPLES)

#
# Rules for building the executables.

cppCube.exe:            cppCube.obj
    $(LINK) $(LFLAGS) /out:$@ cppCube.obj $(CLIBS)

problem is that when I try to run nmake, it doesn’t find the file that instead are present in the directories mentioned:

$ nmake

Microsoft (R) Program Maintenance Utility Version 14.37.32825.0
Copyright (C) Microsoft Corporation.  All rights reserved.

        link.exe /nologo /SUBSYSTEM:CONSOLE /NODEFAULTLIB:LIBC.LIB /LIBPATH:"C:Program FilesAutodeskAliasSurface2023.0lib";"C:Program Files (x86)Windows Kits10Lib10.0.22621.0umx64" /STACK:0xa00000 /VERBOSE /out:cppCube.exe cppCube.obj libalias_api.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib  advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib  odbc32.lib odbccp32.lib comctl32.lib netapi32.lib  version.lib ws2_32.lib

Starting pass 1
Processed /DEFAULTLIB:MSVCRT
Processed /DEFAULTLIB:OLDNAMES
LINK : fatal error LNK1181: cannot open input file 'libalias_api.lib'
NMAKE : fatal error U1077: 'link.exe /nologo /SUBSYSTEM:CONSOLE /NODEFAULTLIB:LIBC.LIB /LIBPATH:"C:Program FilesAutodeskAliasSurface2023.0lib";"C:Program Files (x86)Windows Kits10Lib10.0.22621.0umx64" /STACK:0xa00000 /VERBOSE /out:cppCube.exe cppCube.obj libalias_api.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib  advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib  odbc32.lib odbccp32.lib comctl32.lib netapi32.lib  version.lib ws2_32.lib' : return code '0x49d'
Stop.

I run $ "C:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCAuxiliaryBuildvcvarsall.bat" amd64 getting this message [vcvarsall.bat] Environment initialized for: 'x64' .

I have isntalled Visual Studio Tools and running from a Administrator Developer Command Prompt.

is the errror only complaining of ‘libalias_api.lib’? or also for kernel32.lib? it is phrased in an ambiguous way.

Here is the guide that I followed:
https://help.autodesk.com/view/ALIAS/2023/ENU/?guid=GUID-D9756922-3960-4FC6-AFFC-940A0A5E8C7F

— UPDATE 1 —
After installing Windows SDK and still get LINK error

2

Answers


  1. Chosen as BEST ANSWER

    So I figured that the Makefile was just trying to put together two CLI commands.

    So I put together the two commands, and after some investigation on how to correct the syntax, I finally managed to compile everything with the following CLI commands:

    cl /c /I “C:Program FilesAutodeskAliasSurface2023.0ODSCommoninclude” cppView.cpp /link “C:Program FilesAutodeskAliasSurface2023.0lib”;“C:Program Files (x86)Windows Kits10Lib10.0.22621.0umx64”
    
    link /LIBPATH:"C:Program FilesAutodeskAliasSurface2023.0lib" /LIBPATH:"C:Program Files (x86)Windows Kits10Lib10.0.22621.0umx64" /out:cppView.exe cppView.obj libalias_api.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib netapi32.lib version.lib ws2_32.lib
    

  2. not sure where to find or run vcvarsall

    Well, that’s the problem right there. That batch file sets the environment variables so that Visual Studio components can find each other. In this case, the linker cannot find the SDK.

    The batch file is located inside the Visual Studio install dir. It’s likely also accessible via the start menu, and from inside the Visual Studio IDE.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search