Dev C++ compiler file is used in VS Code

Viewed 38

I have set Dev C++ Compiler MinGW bin folder as Enviroment Variable Path, So that i can use it in cmd and VS Code terminal also, But it compiles well and only performs simple operations.** It cannot give class object function output **

Path which i have added C:\Program Files (x86)\DevC++\MinGW\bin

#include <iostream>
using namespace std;

class Base{
  public: 
    void greet(void){
      cout<<"How are You ? \n"<<endl;
    }
};

int main(){
  Base obj;

  cout<<"Good Morning!\n";
  obj.greet();

  return 0;
}

Output:

Good Morning!

Expect Output:

Good Morning!
How are you ?

I want to know if it is same compiler file of MinGW in DevC++ why cannot we use outside DevC++, why do i have to download seperate compiler for VS Code.

1 Answers

The IDE you're using (Dev C++ / VS Code) doesn't really matter that much with regards to your issue, what does matter is the compiler.

Make sure to not mix compilers, certainly if their versions very much apart.

And Dev C++ is shipped with an old version.

I recommend using a newer MinGW-w64 compiler - you can get a standalone version fro https://winlibs.com/ - and configuring your IDEs (both Dev C++ and VS Code) to use this same compiler.

Only then can you be sure you're linking things together that play well together (unless you're still pulling in other dependencies build with different compilers).

Related