commit 2025-08-25 01:41 add ZCppMainTest/g++_test_000.cpp

This commit is contained in:
2025-08-25 01:41:28 +09:00
parent dec8503d94
commit 4015ba2758
2 changed files with 99 additions and 6 deletions

View File

@ -4383,7 +4383,7 @@ namespace ZNsCPP */
-- 2013-06-23 19:34:00
mingw 의 g++ 에서 아래가 컴파일이 안 된다.
■ g++ 에서 아래가 컴파일이 안 된다.
#include<iostream>
@ -4407,18 +4407,18 @@ namespace ZNsCPP */
□ mingw 컴파일
g++.exe -o mingw_g++_test_000.exe mingw_g++_test_000.cpp -I../
g++.exe -o g++_test_000.exe g++_test_000.cpp -I../
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
# g++.exe -o mingw_g++_test_000.exe mingw_g++_test_000.cpp -I../
mingw_g++_test_000.cpp: In function 'int main(int, char**)':
mingw_g++_test_000.cpp:18:28: error: invalid conversion from 'char**' to 'const cha
# g++.exe -o g++_test_000.exe g++_test_000.cpp -I../
g++_test_000.cpp: In function 'int main(int, char**)':
g++_test_000.cpp:18:28: error: invalid conversion from 'char**' to 'const cha
r**' [-fpermissive]
18 | return Main(AI_ArgCnt, APP_ArgVal);
| ^~~~~~~~~~
| |
| char**
mingw_g++_test_000.cpp:9:39: note: initializing argument 2 of 'int Main(int, cons
g++_test_000.cpp:9:39: note: initializing argument 2 of 'int Main(int, cons
t char**)'
9 | int Main(int AI_ArgCnt=0, const char* APP_ArgVal[]=0)
| ~~~~~~~~~~~~^~~~~~~~~~~~~~
@ -4430,6 +4430,42 @@ namespace ZNsCPP */
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
□ 해결 방법-1
#include<iostream>
using namespace std;
int Main(int AI_ArgCnt=0, const char* const APP_ArgVal[]=0)
{
cout<<"Call Main()"<<endl; return 0;
}
///////////////////////////////////////////////////////////
int main(int AI_ArgCnt, char* APP_ArgVal[])
{
return Main(AI_ArgCnt, APP_ArgVal);
}
///////////////////////////////////////////
□ 해결 방법-2
#include<iostream>
using namespace std;
int Main(int AI_ArgCnt=0, char* const APP_ArgVal[]=0)
{
cout<<"Call Main()"<<endl; return 0;
}
/////////////////////////////////////////////////////
int main(int AI_ArgCnt, char* APP_ArgVal[])
{
return Main(AI_ArgCnt, (const char**)APP_ArgVal);
}
///////////////////////////////////////////
-- 2025-08-25 00:56