Giter VIP home page Giter VIP logo

Comments (10)

interkosmos avatar interkosmos commented on August 29, 2024 1

When linking Fortran modules, the compiler must be able to find the corresponding *.mod files (additionally to the object files). You have to point the include search directory (compiler flag -I) to the directory of raylib.mod, raylib_camera.mod, raylib_math.mod, and raylib_util.mod. For example, just make sure that path /wesley/raylib/build/raylib/include exists and the module file are placed in there.

from fortran-raylib.

interkosmos avatar interkosmos commented on August 29, 2024 1

Either link against the static library libraylib.a or the shared library libraylib.so. For the static one, add the path to the library; for the shared one, link with -lraylib. You may have to set the library search path through compiler flag -L.

Replace libfortran-raylib.a with the path to the library, or copy the library to your project directory along the mod files.

You can ignore the warning regarding the missing include directory.

from fortran-raylib.

SnailMail57 avatar SnailMail57 commented on August 29, 2024

I Found where the mod files really are now I have this

Gfortran -L/wesley/local/lib -I/home/wesley/raylib/build/fortran-raylib -o example example.f90 \ libfortran-raylib.a -lGL -lpthread -ldl -lrt -lX11

It fixed the previous error but now

It gave me the error

/usr/bin/ld: cannot find -lraylib: no such file or directory

And

/usr/bin/ld: cannot find -libfortran-raylib.a: no such file or directory

Thank you for helping

from fortran-raylib.

SnailMail57 avatar SnailMail57 commented on August 29, 2024

I just tried to make the examples with

$make examples

Nonexistent include directory ./include/ [Wmissing-include-dirs]

from fortran-raylib.

SnailMail57 avatar SnailMail57 commented on August 29, 2024

How would I link to the static library.

from fortran-raylib.

interkosmos avatar interkosmos commented on August 29, 2024

If you have a shared library libraylib.so:

$ gfortran -L/path/to/raylib -o example example.f90 \
  libfortran-raylib.a -lraylib -lGL -lpthread -lm

Or, to link the static library libraylib.a:

$ gfortran -o example example.f90 libfortran-raylib.a \
  /path/to/libraylib.a -lGL -lpthread -lm

It‘s probably easier to put libraylib.a, libfortran-raylib.a, and all module files in the workspace directory of your project.

from fortran-raylib.

SnailMail57 avatar SnailMail57 commented on August 29, 2024

Should fortran-raylib be in /build or /build/raylib/fortran-raylib

from fortran-raylib.

interkosmos avatar interkosmos commented on August 29, 2024

Well, it‘s up to you and how you prefer your build environment. Put everything in one directory, or set the absolute/relative paths when compiling. Just make sure the compiler finds all required libraries and module files.

from fortran-raylib.

SnailMail57 avatar SnailMail57 commented on August 29, 2024

I deleted raylib and reinstalled it as well as Fortan-raylib.

I made it a static version of raylib and didn't make a build file but used make in its src file. Then installed fortran-raylib. After marking an example.f90 and put in the original compile Line the only error it gave me was path error.

I then tired your static compile line in your last message and it gave me the same problem. It still doesn't work but better than before. It just doesn't see the librarylib.a

I also retried to make the example with make examples and it worked however when I do: ./bunny I get error core dumped

It says it can read the modules but it dies after it fails to create context

from fortran-raylib.

interkosmos avatar interkosmos commented on August 29, 2024

I cannot reproduce your described issues. Just compile raylib to the static library libraylib.a, and copy the file into your fortran-raylib directory. Then, run:

$ make RAYLIB=libraylib.a
$ make examples RAYLIB=libraylib.a

Instead of libraylib.a, you can alternatively set the absolute or relative path to the static raylib library.

Let’s say your project workspace directory contains the following files:

  • example.f90
  • raylib.mod
  • raylib_camera.mod
  • raylib_math.mod
  • raylib_util.mod
  • libfortran-raylib.a
  • libraylib.a

You can then just run:

$ gfortran -o example example.f90 libfortran-raylib.a libraylib.a -lGL -lpthread -lm

from fortran-raylib.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.