How to compile a simple source file with GCC on Linux

I am trying to compile a set of source files in C on Linux (Ubuntu). When I try to run the following command, I get an error message "ruby.h" not found.

gcc custom_ext.c

This gave me the following error message.

custom_ext.h:10: fatal error: ruby.h: No such file or directory

So, I downloaded all the Ruby source code and put it in a dummy directory /home/braga/ruby_source/ruby_1_8_7. I know that I need to include this directory in the path so that GCC can identify and pick up ruby.h, but I have no idea how to do this. Please, help!!!

+3
source share
4 answers

Is ruby-dev installed?

, , Ubuntu repositorie ( "apt-get", "aptitude" ). . , .

( ), ( tarball, INSTALL).

+7

-I /home/braga/ruby_source/ruby_1_8_7. , ruby.h - , .

+1

- . , /-name ruby.h ,

+1

, , Ruby, . , -, , . , , , - .

Except for purely convenience reasons, it’s still better to install all the appropriate development packages from the repository, because the headers you uploaded may not coincide with the binary libraries you want to link to. If they do not, and if they are not compatible with binary data, you are in deep trouble. The apt-file and apt-cache search commands are very useful in finding the specific name of the package that you need.

+1
source

Source: https://habr.com/ru/post/1782260/


All Articles