Skip to content

Instantly share code, notes, and snippets.

@CristianCantoro
Created May 15, 2018 14:55
Show Gist options
  • Save CristianCantoro/0b3c5eeeeb7f4065dd514fdb21cb82de to your computer and use it in GitHub Desktop.
Save CristianCantoro/0b3c5eeeeb7f4065dd514fdb21cb82de to your computer and use it in GitHub Desktop.
An header that works for C and C++
#ifndef TSP_H
#define TSP_H
#ifdef __cplusplus
// C++ code
using namespace std;
namespace helpers {
long long get_elapsed_time(void);
bool has_reached_timeout(void);
void setup(void);
}
#else
// C code
#include <stdbool.h>
long long get_elapsed_time(void);
bool has_reached_timeout(void);
void setup(void);
#error Only C++ is supported
#endif
#endif
#pragma once
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment