When I use Run code, I get normal output but when I use run C/C++ file I don’t get the desired output instead get a bunch of things written.
This is what I get in Debug console when running C program –
=thread-group-added,id="i1"
GNU gdb (GDB) 7.6.1
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
=cmd-param-changed,param="pagination",value="off"
=cmd-param-changed,param="args",value="2>CON 1>CON <CON"
[New Thread 27824.0x27d4]
[New Thread 27824.0x6c74]
Loaded 'C:WINDOWSSysWOW64kernel32.dll'. Symbols loaded.
Loaded 'C:WINDOWSSysWOW64KernelBase.dll'. Symbols loaded.
Loaded 'C:WINDOWSSysWOW64msvcrt.dll'. Symbols loaded.
Hello Kaddu=thread-exited,id="2",group-id="i1"
The program 'C:UserspriyaOneDriveDesktopCodeCstartfile.exe' has exited with code 0 (0x00000000).
This is the output that I get –
PS C:UserspriyaOneDriveDesktopCode> & 'c:Userspriya.vscodeextensionsms-vscode.cpptools-1.20.5-win32-x64debugAdaptersbinWindowsDebugLauncher.exe' '--stdin=Microsoft-MIEngine-In-n5rpq4hl.1xu' '--stdout=Microsoft-MIEngine-Out-d1oid10y.pwm' '--stderr=Microsoft-MIEngine-Error-eoh2k5i2.yve' '--pid=Microsoft-MIEngine-Pid-0kkiqkvh.dgw' '--dbgExe=C:MinGWbingdb.exe' '--interpreter=mi'
PS C:UserspriyaOneDriveDesktopCode>
This is What I get in terminal while running C++ program –
* Executing task: C/C++: gcc.exe build active file
Starting build...
cmd /c chcp 65001>nul && C:MinGWbingcc.exe -fdiagnostics-color=always -g C:UserspriyaOneDriveDesktopCodeCstartfile.c -o C:UserspriyaOneDriveDesktopCodeCstartfile.exe
Build finished successfully.
* Terminal will be reused by tasks, press any key to close it.
* Executing task: C/C++: gcc.exe build active file
Starting build...
cmd /c chcp 65001>nul && C:MinGWbingcc.exe -fdiagnostics-color=always -g C:UserspriyaOneDriveDesktopCodeC++Start.cpp -o C:UserspriyaOneDriveDesktopCodeC++Start.exe
C:UserspriyaAppDataLocalTempccWQkuvX.o: In function `main':
C:/Users/priya/OneDrive/Desktop/Code/C++/Start.cpp:4: undefined reference to `std::cout'
C:/Users/priya/OneDrive/Desktop/Code/C++/Start.cpp:4: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
C:UserspriyaAppDataLocalTempccWQkuvX.o: In function `_tcf_0':
c:/mingw/lib/gcc/mingw32/6.3.0/include/c++/iostream:74: undefined reference to `std::ios_base::Init::~Init()'
C:UserspriyaAppDataLocalTempccWQkuvX.o: In function `_static_initialization_and_destruction_0':
c:/mingw/lib/gcc/mingw32/6.3.0/include/c++/iostream:74: undefined reference to `std::ios_base::Init::Init()'
collect2.exe: error: ld returned 1 exit status
Build finished with error(s).
* The terminal process terminated with exit code: -1.
* Terminal will be reused by tasks, press any key to close it.
*
I have also attached screen shot of error which I get while trying to run C++ program.*
This is the first dialog box that I get.
This is what I get after clicking Debug anyway.
The code is a simple hello world code and there is no error in the code. I tried finding solution on Youtube and google but could not find anything helpful. I have tried to give all info that might help in resolving the issue but if I missed something important than I am really sorry for that. I hope to receive some assitance.
C program code –
#include<stdio.h>
int main () {
printf("Hello Kaddu");
return 0;
}
C++ program code –
#include <iostream>
int main() {
std::cout << "Hello World!";
return 0;
}