gabe gabe - 1 year ago 108
C++ Question

gcc returns "No such file or directory"

I'm trying to install Mathtex on my Ubuntu 16.04 server for my engineering wiki. It has been a nightmare, just as it was in the past when I tried this.

First, I've installed mathtex via apt-get. That complains of a missing directory. After manually creating those directory it moves on to complain of another. Finally complains of a missing cache directory. I create the cache just like the others and mathtex still complains that the cache directory is missing...

Then I attempt to install via the instructions on the website ( In other words, install the dependencies LaTeX and dvipng. Then compile the program using cc (although I use gcc). I've gotten this to work in previous installations of Ubuntu - 12.04 or 14.04 - but can't find those instructions anymore. I was paying for a service until this summer when they went out of business.

Here is the compile line:

cc mathtex.c –DLATEX=\"$(which latex)\" –DDVIPNG=\"$(which dvipng)\" –o mathtex.cgi

Here is the return:

cc: error: –DLATEX="/usr/bin/latex": No such file or directory
cc: error: –DDVIPNG="/usr/bin/dvipng": No such file or directory
cc: error: –o: No such file or directory

I've also tried replacing
$(which latex)
$(which pdftex)
(/usr/bin/latex is a symbolic link to /usr/bin/pdftex) and
, and
. Same result, the error says there is no such file or directory for all of them.

Googling this error only returns help for people who can't get Ubuntu to recognize gcc as the cc compiler. That's not my issue though.

ams ams
Answer Source

Did you copy that command from a document? You have the wrong kind of dashes on your options.

Delete the (en dash) and replace it with -.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download