4

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?

sdwilsh
  • 4,674
  • 1
  • 22
  • 20
Dirk
  • 3,095
  • 4
  • 19
  • 37

1 Answers1

2

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.

sdgfsdh
  • 33,689
  • 26
  • 132
  • 245