no i definately used Visual Studio Command Prompt
c:\Program Files\Microsoft Visual Studio 9.0\VC\run_process_from_service>make.bat
Printable View
no i definately used Visual Studio Command Prompt
c:\Program Files\Microsoft Visual Studio 9.0\VC\run_process_from_service>make.bat
this is the only visual studio command prompt i found:
Attachment 31377
Given you have document entries for VS2010 and VS2012, perhaps your environment is screwed up? Did you install VS2010/VS2012 and then uninstall them? Have you looked at the system and/or user path settings - are there any entries that are stale? Is the path too long? To check, open a command prompt and type set.
Well, if you really run that, and compiler is not able to find windows.h, please take my condolences, as most probably your VS installation is broken. I used Visual Studio all versions since v4.0, and never had a problem like that. Never.
This is what my VSCP gives with my sample placed in C:\testService folder:
Windows 7, VS2010
Same source code, Windows XP SP3, VS.NET2003Code:Setting environment for using Microsoft Visual Studio 2010 x86 tools.
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>cd \testService
C:\testService>make
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
test.cpp
Microsoft (R) Incremental Linker Version 10.00.40219.01
Copyright (C) Microsoft Corporation. All rights reserved.
/out:test.exe
test.obj
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
10.cpp
Microsoft (R) Incremental Linker Version 10.00.40219.01
Copyright (C) Microsoft Corporation. All rights reserved.
/out:10.exe
/out:mysvcx.exe
10.obj
C:\testService>
This is how it runs:Code:Setting environment for using Microsoft Visual Studio .NET 2003 tools.
(If you have another version of Visual Studio or Visual C++ installed and wish
to use its tools from the command line, run vcvars32.bat for that version.)
C:\Documents and Settings\Igor>cd \testService
C:\testService>make
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.
test.cpp
Microsoft (R) Incremental Linker Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.
/out:test.exe
test.obj
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.
10.cpp
Microsoft (R) Incremental Linker Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.
/out:10.exe
/out:mysvcx.exe
10.obj
LINK : warning LNK4089: all references to 'USER32.dll' discarded by /OPT:REF
C:\testService>
...and this is the log:Code:C:\testService>setup
C:\testService>if -u == goto UNINSTALL
C:\testService>sc create MyServiceX binPath= "C:\testService\mysvcx.exe"
[SC] CreateService SUCCESS
C:\testService>sc start MyServiceX
SERVICE_NAME: MyServiceX
TYPE : 10 WIN32_OWN_PROCESS
STATE : 2 START_PENDING
(NOT_STOPPABLE,NOT_PAUSABLE,IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x7d0
PID : 2656
FLAGS :
C:\testService>test.bat run
SERVICE_NAME: MyServiceX
TYPE : 10 WIN32_OWN_PROCESS
STATE : 4 RUNNING
(STOPPABLE,NOT_PAUSABLE,ACCEPTS_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
C:\testService>test.bat stop
SERVICE_NAME: MyServiceX
TYPE : 10 WIN32_OWN_PROCESS
STATE : 4 RUNNING
(STOPPABLE,NOT_PAUSABLE,ACCEPTS_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
C:\testService>setup -u
C:\testService>if -u == -u goto UNINSTALL
C:\testService>sc stop MyServiceX
SERVICE_NAME: MyServiceX
TYPE : 10 WIN32_OWN_PROCESS
STATE : 1 STOPPED
(NOT_STOPPABLE,NOT_PAUSABLE,IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
C:\testService>sc delete MyServiceX
[SC] DeleteService SUCCESS
C:\testService>
Of course you should remember about running your command prompt as administrator to be able to control your service states.Code:[05/02/13 22:19:11] ++ Start ++
[05/02/13 22:19:24] C:\testService\test.exe
[05/02/13 22:19:24] Waiting for test.exe stop...
[05/02/13 22:19:32] Detected test.exe stop.
[05/02/13 22:19:32] Quitting thread.
[05/02/13 22:19:39] -- Stop --
If you want to move any further from where you are, you should start with reproducing this behavior. Please note, the log file is the debugging tool itself, and so far it's very unlikely you need anything more sophisticated.
yes i had the express version of VS2012 but i uninstalled itQuote:
Did you install VS2010/VS2012 and then uninstall them?
so this is effecting my VS2008 now?
i don't know how it can be broken because other programs work fineQuote:
VS installation is broken
Quite possibly.
But you are having problems with the VS command prompt environment, aren't you? That's very different from the IDE, compiler and linker. So it's possible that the environment is messed up from installing/uninstalling 2010/2012, but the 2008 compiler still works. Reinstall 2008 to be sure (and the appropriate service packs).
Did you open a command prompt and type the set command in order to view the path settings like I mentioned?