SpaceVim: difficulty getting simple cpp and header file to compile and run

182 Views Asked by At

I have a very simple structure:

myproject\
    src\
        main.cpp
    include\
        maininclude.h
    .clang

main.cpp is:

#include <stdio.h>
#include "maininclude.h"
int main(){
  foo_ f;
  f.seta(5);
  printf("value of f.a is %d\n", f.geta());
  getchar();
}

maininclude.h is

class foo_{
  private:
  int a;
  public:
  int geta() const {return a;}
  void seta(int val) {a = val;}
};

.clang is:

-I./include

When I then hit <space> l r after opening vim from myproject\ folder, there the Runner window opens but nothing is displayed. Image displayed below.

enter image description here

Is there a separate window where the output is shown?

1

There are 1 best solutions below

1
On BEST ANSWER

You should remove getchar();, because this function is waiting for input. Or you can press i in runner buffer, and then insert any character.

enter image description here