LINUX.ORG.RU

Как обеспечить эквивалентность #include <GL/glut_cgx.h> и #include «GL/glut_cgx.h»

 ,


0

1
extUtil.h:37:12: fatal error: GL/glut_cgx.h: No such file or directory
   #include <GL/glut_cgx.h>

если в файле extUtil.h поменять #include <GL/glut_cgx.h> на #include «GL/glut_cgx.h» ошибка пропадет.

Вопрос как переписать

    %.o: %.c
	g++ -c -MD $<
так чтобы
#include <GL/glut_cgx.h>
#include "GL/glut_cgx.h"
воспринимались эквивалентно.

Ответ на: комментарий от raspopov

Я не спец, но тут спецы написали

‘-I dir’
‘--include-dir=dir’

    Specifies a directory dir to search for included makefiles. See Including Other Makefiles. If several ‘-I’ options are used to specify several directories, the directories are searched in the order specified.
 

и не забудь библиотеки - аналогичный параметр «-L».

‘-L’
‘--check-symlink-times’

    On systems that support symbolic links, this option causes make to consider the timestamps on any symbolic links in addition to the timestamp on the file referenced by those links. When this option is provided, the most recent timestamp among the file and the symbolic links is taken as the modification time for this target file.

Иди читай мануалы.

saufesma
() автор топика
Ответ на: комментарий от i-rinat

Отнюдь, достали самоуверенные и невежественные, а с такими по другому нельзя. Если не нравится, отваливай, пустые беседы меня не интересуют.

saufesma
() автор топика
Последнее исправление: saufesma (всего исправлений: 1)
Ответ на: комментарий от saufesma

Ты не понял. Это ты самоуверенный невежда.

Тебе указали решение, в максимально сжатой форме, а ты его не понял и начал в ответ учить. Как можно быть настолько уверенным в вопросе, который ты явно не понимаешь? Ты же это непонимание явно обозначил, начав тему!

i-rinat ★★★★★
()
Ответ на: комментарий от i-rinat

Когда не знаешь как использовать -I, оно выдаёт

$ make -d
GNU Make 4.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Reading makefile 'Makefile'...
Reading makefile 'Makefile.inc' (search path) (no ~ expansion)...
Updating makefiles....
 Considering target file 'Makefile.inc'.
  Looking for an implicit rule for 'Makefile.inc'.
  Trying pattern rule with stem 'Makefile.inc'.
  Trying implicit prerequisite 'Makefile.inc.o'.
  Trying pattern rule with stem 'Makefile.inc'.
  Trying implicit prerequisite 'Makefile.inc.c'.
  Trying pattern rule with stem 'Makefile.inc'.
  Trying implicit prerequisite 'Makefile.inc.cc'.
  Trying pattern rule with stem 'Makefile.inc'.
  Trying implicit prerequisite 'Makefile.inc.C'.
  Trying pattern rule with stem 'Makefile.inc'.
  Trying implicit prerequisite 'Makefile.inc.cpp'.
  Trying pattern rule with stem 'Makefile.inc'.
  Trying implicit prerequisite 'Makefile.inc.p'.
  Trying pattern rule with stem 'Makefile.inc'.
  Trying implicit prerequisite 'Makefile.inc.f'.
  Trying pattern rule with stem 'Makefile.inc'.
  Trying implicit prerequisite 'Makefile.inc.F'.
  Trying pattern rule with stem 'Makefile.inc'.
  Trying implicit prerequisite 'Makefile.inc.m'.
  Trying pattern rule with stem 'Makefile.inc'.
  Trying implicit prerequisite 'Makefile.inc.r'.
  Trying pattern rule with stem 'Makefile.inc'.
  Trying implicit prerequisite 'Makefile.inc.s'.
  Trying pattern rule with stem 'Makefile.inc'.
  Trying implicit prerequisite 'Makefile.inc.S'
продолжается еще несколько сотен строк и выскакивает с error.

Можешь попробовать сам, а заодно покури мануал.

saufesma
() автор топика
Ответ на: комментарий от i-rinat

Тебе указали решение,

Это не решение, это незнание.

Ты же это непонимание явно обозначил, начав тему!

В теме я четко определил суть вопроса.

Ответа пока нет.

saufesma
() автор топика
Ответ на: комментарий от fluorite
$ make -f tut
g++ -I. -c -MD meshSurf.c
In file included from cgx.h:25:0,
                 from meshSurf.c:30:
extUtil.h:37:12: fatal error: GL/glut_cgx.h: No such file or directory
   #include <GL/glut_cgx.h>
            ^~~~~~~~~~~~~~~
compilation terminated.
tut:17: recipe for target 'meshSurf.o' failed
make: *** [meshSurf.o] Error 1

и моя идея с заменой #include <> на #include «» не сработала

$ make -f tut
g++ -I. -c -MD meshSurf.c
In file included from cgx.h:25:0,
                 from meshSurf.c:30:
extUtil.h:37:12: fatal error: GL/glut_cgx.h: No such file or directory
   #include "GL/glut_cgx.h"
            ^~~~~~~~~~~~~~~
compilation terminated.
tut:17: recipe for target 'meshSurf.o' failed
make: *** [meshSurf.o] Error 1

и грубишь

Неправильно, отсеиваю не нужных людей.

Ты вроде на С++ пишешь. C makefile можешь помочь.

saufesma
() автор топика
Последнее исправление: saufesma (всего исправлений: 1)
Ответ на: комментарий от saufesma
  1. Читаешь про разницу инклудов через кавычки и угловые скобки:

https://gcc.gnu.org/onlinedocs/cpp/Search-Path.html

  1. Определяешь где лежит каталог с заголовочниками GL относительно твоего проекта и конкретного файла.

  2. Принимаешь решение добавить путь к родительской директории GL в правила сборки.

  3. Добавляешь.

fluorite ★★★★★
()
Ответ на: комментарий от fluorite
$ make -f tuta-c
g++ -I. ../../glut-3.5/src/GL -c -MD renumberfrd.c
In file included from renumberfrd.c:2:0:
./extUtil.h:37:12: fatal error: GL/glut_cgx.h: No such file or directory
   #include <GL/glut_cgx.h>
            ^~~~~~~~~~~~~~~
compilation terminated.
tuta-c:13: recipe for target 'renumberfrd.o' failed
make: *** [renumberfrd.o] Error 1
$ make -f tuta-c
g++ ../../glut-3.5/src/GL -c -MD renumberfrd.c
renumberfrd.c:2:10: fatal error: extUtil.h: No such file or directory
 #include <extUtil.h>  ---make вызвал в этой дир
          ^~~~~~~~~~~
compilation terminated.
tuta-c:13: recipe for target 'renumberfrd.o' failed
make: *** [renumberfrd.o] Error 1

Тему надо закрывать.

saufesma
() автор топика
Ответ на: комментарий от saufesma

"../../glut-3.5/src/GL" — что с этим должен был сделать gcc? использовать как каталог с заголовочными файлами? тогда пропущен ключ "-I".
Почему в этом пути «GL»? для #include <GL/glut_cgx.h> будет искаться ../../glut-3.5/src/GL/GL/glut_cgx.h, найдется? Поменяйте так, чтобы нашлось. И заодно, чтобы при запуске из другого каталога тоже нашлось.

bormant ★★★★★
()
Ответ на: комментарий от bormant

Тут я провошкался с CalculiX ccx makefile

Граждане и гражданки ЛОР, кто знаком с таким выхлопом от make

по ходу случайно получилось. Сокращенная версия выхлопа make

.............
Finished prerequisites of target file 'ccx_2.11'.
 Prerequisite 'ccx_2.11.o' is older than target 'ccx_2.11'.
 Prerequisite 'ccx_2.11.a' is older than target 'ccx_2.11'.
 Prerequisite 'date.pl' is older than target 'ccx_2.11'.
No need to remake target 'ccx_2.11'.
make: 'ccx_2.11' is up to date.

А тут CalculiX cgx, я не программист, если можешь написать то давай поговорим о вознаграждении. Еще и netgen makefile висит.

saufesma
() автор топика
Последнее исправление: saufesma (всего исправлений: 1)