-->

Nuclide C++ simple Buck config

2019-05-06 22:34发布

问题:

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:

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.