I am writing a simple program for practice for my final exam, but seem to have come across a weird error. This code compiles, but when I run it is just blank. It doesn't even reach first line of main, as I have tested in my main.cpp. Then if I type something, for example an s, it just says:
1 2
s
"<stdin>", line 1: incomplete name definition
What could be causing this? Here is my code below.
main.cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include <iostream>
#include <cstring>
#include "flex.h"
usingnamespace std;
int main()
{
cout << "first line of main" << endl;
Flex a;
cout << "made it" << endl;
cout << a;
cout << "made it past cout << a";
return 0;
}
It's likely that flex.h is not your flex.h, so you could try renaming it.
There's also no need to compile headers, so you can remove that from your makefile.
Edit: there is a program called flex, which was the one you executed. Make sure to execute your program
from the current directory with ./flex, not flex.