Reputation: 1
I need help.
I installed Visual Studio Code, then I installed the latest version of MingW for C++ programming.
When I try to run the program, I got an error: "cc1plus is not detected"
.
I tried to fix it on my own by putting the directory in the system environment variables.
Then I received another error:
main': C:/_/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crt0_c.c:18: undefined reference to WinMain' collect2.exe: error: ld returned 1 exit status PS C:\Users\angel\OneDrive\Documents\Visual Studio Code\PRogramming WorkSpace\C++>
I don't understand what this error means. I hope someone can help me solve this problem.
My Code:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!";
return 0;
}
Output:
PS C:\Users\angel\OneDrive\Documents\Visual Studio Code\PRogramming WorkSpace> cd "c:\Users\angel\OneDrive\Documents\Visual Studio Code\PRogramming WorkSpace\C++\" ; if ($?) { g++ test.cpp -o test } ; if ($?) { .\test }
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o): in function `main':
C:/_/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crt0_c.c:18: undefined reference to `WinMain'
collect2.exe: error: ld returned 1 exit status
PS C:\Users\angel\OneDrive\Documents\Visual Studio Code\PRogramming WorkSpace\C++>
Upvotes: 0
Views: 799