Nuclide C++ simple Buck config

2019-05-06 22:16发布

I want to build and run C++ programs from Nuclide using Buck. The problem is that I don't know how to setup a simple Buck configuration file in Nuclide to build and then run a .cpp file.

So does someone have a suggestion?

1条回答
我想做一个坏孩纸
2楼-- · 2019-05-06 22:54

Building a hello-world program with Buck is very easy. Create the following files in your project directory:

.buckconfig

(can be empty)

main.cpp:

#include <iostream>

int main() {
  std::cout << "Hello, world. " << std::endl;
  return 0;
}

BUCK

cxx_binary(
  name = 'hello-world',
  srcs = [
    'main.cpp'
  ],
)

Nuclide should find everything for you if you open Atom from your project folder.

To check that every works, run:

buck run //:hello-world

That should be enough to get started; further information can be found on the Buck website.

查看更多
登录 后发表回答