Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
I have been trying to build the protk_install_example solution provided by PTC and facing the errors shown in the screenshots below. I am using Creo 7.0.2.0 and VS19 to build the solution. The makefile is defined as follows,
# -----------------------------------------------------------------------------
# File Name
MAKEFILENAME = make_install
# Machine Type
PRO_MACHINE_TYPE = x86e_win64
# Executable names
EXE = pt_inst_test.exe
EXE_DLL = pt_inst_test.dll
# Pro/Toolkit Source & Machine Loadpoint (EXTERNAL USE - DEFAULT)
PROTOOL_src=$(PROE_INSTALL_PATH)/protoolkit
PROTOOL_SYS = $(PROTOOL_SRC)/$(PRO_MACHINE_TYPE)
# Pro/Toolkit Source & Machine Loadpoint (PTC INTERNAL USE)
#PROTOOL_src=$(PTCSRC)/protoolkit
#PROTOOL_SYS = $(PTCSYS)
ICU_PATH = $(PROTOOL_SYS)/obj
# Include File Paths
INCS = -I. -I$(PROTOOL_SRC)/protk_appls/includes -I$(PROTOOL_SRC)/includes
# Compiler Flags
CC = cl
MACH = -DPRO_MACHINE=36 -DPRO_OS=4
CCFLAGS = -c -GS -fp:precise -D_WSTDIO_DEFINED -D_USING_V110_SDK71_
CFLAGS = $(CCFLAGS) $(INCS) $(MACH)
# Libraries
PTCLIBS = $(PROTOOL_SYS)/obj/protoolkit_NU.lib \
$(ICU_PATH)/ucore.lib \
$(ICU_PATH)/udata.lib
PTCLIBS_DLL = $(PROTOOL_SYS)/obj/protk_dll_NU.lib \
$(ICU_PATH)/ucore.lib \
$(ICU_PATH)/udata.lib
LIBS = libcmt.lib kernel32.lib user32.lib wsock32.lib advapi32.lib mpr.lib winspool.lib netapi32.lib psapi.lib gdi32.lib shell32.lib comdlg32.lib ole32.lib ws2_32.lib
# Object files
OBJS = TestInstall.obj TestError.obj TestRunmode.obj UtilString.obj PTApplsUnicodeUtils.obj
# Linker
LINK = link
$(EXE) : $(OBJS) $(PTCLIBS)
@echo Start at `date`
@echo PROTOOL_src=$(PROTOOL_SRC)
@echo PROTOOL_SYS = $(PROTOOL_SYS)
#Executable applications compiled using WinMain() instead of main() should set the subsystem to windows instead of console.
$(LINK) /subsystem:console -out:$(EXE) /debug:none /machine:amd64 @<<longline.list
$(OBJS) $(PTCLIBS) $(LIBS)
<<
@echo Finished at `date`
del $(OBJS)
# Dll target
dll: $(EXE_DLL)
$(EXE_DLL) : $(OBJS) $(PTCLIBS_DLL)
@echo Start at `date`
@echo PROTOOL_src=$(PROTOOL_SRC)
@echo PROTOOL_SYS = $(PROTOOL_SYS)
$(LINK) /subsystem:console -out:$(EXE_DLL) /debug:none /machine:amd64 /dll @<<longline.list
$(OBJS) $(PTCLIBS_DLL) $(LIBS)
<<
@echo Finished at `date`
del $(OBJS)
# object dependencies
PROTK_INST = $(PROTOOL_SRC)/protk_appls/pt_install_test/pt_install_src
PROTK_UTILS = $(PROTOOL_SRC)/protk_appls/pt_examples/pt_utils
TestInstall.obj: $(PROTK_INST)/TestInstall.c
$(CC) $(CFLAGS) $(PROTK_INST)/TestInstall.c
TestError.obj: $(PROTK_UTILS)/TestError.c
$(CC) $(CFLAGS) $(PROTK_UTILS)/TestError.c
TestRunmode.obj: $(PROTK_UTILS)/TestRunmode.c
$(CC) $(CFLAGS) $(PROTK_UTILS)/TestRunmode.c
UtilString.obj: $(PROTK_UTILS)/UtilString.c
$(CC) $(CFLAGS) $(PROTK_UTILS)/UtilString.c
PTApplsUnicodeUtils.obj: $(PROTK_UTILS)/PTApplsUnicodeUtils.c
$(CC) $(CFLAGS) $(PROTK_UTILS)/PTApplsUnicodeUtils.c
clean :
del $(OBJS)
del $(EXE)
nmake -f $(MAKEFILENAME)
clean_dll :
del $(OBJS)
del $(EXE_DLL)
nmake -f $(MAKEFILENAME) dll
# -----------------------------------------------------------------------------
I have given the env. variable PROE_INSTALL_PATH as "C:\PTC\Creo7.0.2.0\Common_Files".
I request the community to help me solve this issue. TIA
this question was raised many times before.
search for 'nmake' in community posts.
the bottom line is you have to use 'x64 native tools command prompt' shortcut from visual studio installation folder to start a command prompt on a windows machine and to run nmake -f ... command from it.
to use visual studio solution build process - visual studio project needs to be configured for use with pro/toolkit API - there is a sample visual studio solution zip archive in pro/toolkit 'obj' directory.
HIH
Hi @FV ,
Thanks for the reply. I tried searching through the community before but could not find any accepted solution. I also went through your suggestions in this post. But, I am struck by your last comment that mentions running nmake from obj folder. Could you please explain where that nmake in obj folder is located? If you are referring to the toolkit installation director, I couldn't find any nmake in that location.
HIH
Before you run the PTC batch you have to make sure that the MS VC environment is initialized by a call to vcsetall.bat or something similar. After this the PTC batch will work, you may specify DLL as an argument but this is optional. Use some print statements at the beginning to make sure the vars have the correct value.