"cannot execute binary file"

Hello, I recently tried to compile my program with:

g++ -o RayTracer PerformanceManager.h PerformanceManager.cpp Vec3f.h Image.h Image.cpp FileManager.h FileManager.cpp GeometricObjects.h TGAManager.h TGAManager.cpp Plane.h Plane.cpp Sphere.h Triangle.h Scene.h Scene.cpp TextManager.h TextManager.cpp RayTracer.h RayTracer.cpp main.cpp

and it compiled ok. Gived it execution permission, but when tried to run it, it said
cannot execute binary file

Issuing a
file ./RayTracer
gives me a
./RayTracer: GCC precompiled header (version 013) for C++

So what I am doing wrong? Thanks for your time.

Nevermind, figured out that I forgot to include two files.
Last edited on

Some tips:

Normally one doesn't compile header files, because they are normally included in the cpp files. I like to have it so I am compiling all of the cpp files in the directory.

Also turn all the warnings on ; specify a std to compile against, preferably the latest one that is installed:

g++ - std=c++17 -Wall -Wextra -pedantic-errors *.cpp -o RayTracer

It's worth reading the manual, there are zillions of options, but still worth it.

Good Luck :+)
Registered users can post here. Sign in or register to post.