Answered by:
main function: argc is negative number

Question
-
Hi fellow programmers;
I am writing a cross platform linker using the Microsoft SDK
but the argc argument is negative. I have written a batch
script to build the test program which is called main_Test1.bat.
The following is the batch script:
cl.exe /c /TC /Gz /MD /w main_Test1.c
CD ..\objs
link.exe /SUBSYSTEM:CONSOLE /ENTRY:test_main /OUT:..\tests\main_Test1.exe ..\tests\main_Test1.obj ^
factory.obj io.obj main.obj util.obj vlid.obj kernel32.lib msvcrt.lib
CD ..\tests
PAUSE
The following is the code:
int test_main(int argc, char *argv[], char *env[]){ //Variable declarations. int ret; //Argument checks. //Initializations. //Main logic. printf("\nargc = %d\n", argc); }
When I build and run the test program, I get a negative number
for argc.
Tuesday, October 13, 2020 9:50 PM
Answers
-
Try asking in the C++ discussion group: https://docs.microsoft.com/en-us/answers/topics/c++.html
- Proposed as answer by Guido Franzke Wednesday, October 14, 2020 5:48 AM
- Marked as answer by Guido Franzke Tuesday, October 20, 2020 6:05 AM
Tuesday, October 13, 2020 9:54 PM -
I'd try asking for help over here.
https://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows Server] Datacenter Management
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.- Proposed as answer by Guido Franzke Wednesday, October 14, 2020 5:49 AM
- Marked as answer by Guido Franzke Tuesday, October 20, 2020 6:05 AM
Tuesday, October 13, 2020 10:44 PM
All replies
-
Try asking in the C++ discussion group: https://docs.microsoft.com/en-us/answers/topics/c++.html
- Proposed as answer by Guido Franzke Wednesday, October 14, 2020 5:48 AM
- Marked as answer by Guido Franzke Tuesday, October 20, 2020 6:05 AM
Tuesday, October 13, 2020 9:54 PM -
I'd try asking for help over here.
https://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows Server] Datacenter Management
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.- Proposed as answer by Guido Franzke Wednesday, October 14, 2020 5:49 AM
- Marked as answer by Guido Franzke Tuesday, October 20, 2020 6:05 AM
Tuesday, October 13, 2020 10:44 PM