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

View File

@ -0,0 +1,57 @@
#include<iostream>
using namespace std;
int Main(int AI_ArgCnt=0, const char* APP_ArgVal[]=0)
{
cout<<"Call Main()"<<endl; return 0;
}/*
int Main(int AI_ArgCnt=0, const char* APP_ArgVal[]=0)*/
int main(int AI_ArgCnt, char* APP_ArgVal[])
{
return Main(AI_ArgCnt, APP_ArgVal);
}/*
int main(int AI_ArgCnt, char* APP_ArgVal[])*/
/*################################################################################
<EFBFBD><EFBFBD> mingw <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
g++ -o g++_test_000.exe g++_test_000.cpp -I../
<EFBFBD><EFBFBD> linux <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
g++ -o g++_test_000.exe g++_test_000.cpp -I../
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ g++ -o g++_test_000.exe g++_test_000.cpp -I../
g++_test_000.cpp: In function <20><>int main(int, char**)<29><>:
g++_test_000.cpp:18:28: error: invalid conversion from <20><>char**<2A><> to <20><>const char**<2A><> [-fpermissive]
18 | return Main(AI_ArgCnt, APP_ArgVal);
| ^~~~~~~~~~
| |
| char**
g++_test_000.cpp:9:39: note: initializing argument 2 of <20><>int Main(int, const char**)<29><>
9 | int Main(int AI_ArgCnt=0, const char* APP_ArgVal[]=0)
| ~~~~~~~~~~~~^~~~~~~~~~~~~~
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
# date
Mon Aug 25 01:39:11 KST 2025
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
# g++ --version
g++.exe (Rev2, Built by MSYS2 project) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
################################################################################*/