Cxx Tips: Difference between revisions

From EggeWiki
No edit summary
 
No edit summary
Line 1: Line 1:
!I'm getting this error when I run make
==I'm getting this error when I run make==
<pre>
<pre>
Makefile:62: *** missing separator.  Stop.
Makefile:62: *** missing separator.  Stop.
Line 6: Line 6:
This is on of my favorites.  It's often because you have four spaces instead of a tab prefixing the line.
This is on of my favorites.  It's often because you have four spaces instead of a tab prefixing the line.


!How to turn on or off asserts in C++
==How to turn on or off asserts in C++==
<pre>
<pre>
$ cat x.c
$ cat x.c

Revision as of 08:10, 10 May 2006

I'm getting this error when I run make

Makefile:62: *** missing separator.  Stop.

This is on of my favorites. It's often because you have four spaces instead of a tab prefixing the line.

How to turn on or off asserts in C++

$ cat x.c
#include <assert.h>

int main(int a, char** b) {
        assert(0);
        return 0;
}
$ gcc x.c -DNDEBUG
$ ./a.out
$ gcc x.c
$ ./a.out
Assertion failed: 0, file x.c, line 4
Abort (core dumped)

NB you will have compiled away all the asserts by defining NDEBUG!