#include<matrix>

I have an example program that has #include<matrix>

When I compile I get an error that says

fatal error: matrix: No such file or directory
compilation terminated.

What is this #include<matrix.h>

Looks like a header file that you don't have.

Someone somewhere wrote a file, named "matrix"

Then you, I presume, found some code somewhere that used this file that mysterious stranger wrote; #include<matrix>

You can't use a file that you don't have. Do you have the file named "matrix" ? Where did you get the code that's trying to use it?
Last edited on
Is it #include <matrix> or #include <matrix.h>? It's an important difference.

I'm not sure if this is actually a rule, but the only extension-less C++ header files that exist are the standard library ones, like <iostream>, <vector>, <cstring>, etc. (Things like <stdlib.h> only exist for backwards compatibility with C, they shouldn't normally be used.)

Having a custom header file called "matrix" instead of "matrix.h" could be confusing to someone reading your code.
Last edited on
I'm not sure if this is actually a rule

Not a rule. Names of files can be whatever you like.

That said, the tools that you use (and yourself) do expect "traditional" naming scheme.

Extensionless filenames are fine for library headers file that you practically never read yourself. (You study the documentation for correct usage.)
Thanks, after reading that, I noticed some libraries like OpenSceneGraph will style
their header files as #include <osg/Camera>, so I guess it is used in places other than the standard library. Though personally I would still avoid it (at least without its own directory like "osg/").
Last edited on
Topic archived. No new replies allowed.