From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.140.232.212 with SMTP id d203mr6834085qhc.8.1444323118888; Thu, 08 Oct 2015 09:51:58 -0700 (PDT) X-Received: by 10.182.60.130 with SMTP id h2mr55576obr.28.1444323118849; Thu, 08 Oct 2015 09:51:58 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!z77no8364439qge.1!news-out.google.com!n2ni24336igy.0!nntp.google.com!kq10no18527779igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 8 Oct 2015 09:51:58 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=189.77.226.1; posting-account=TRgI1QoAAABSsYi-ox3Pi6N-JEKKU0cu NNTP-Posting-Host: 189.77.226.1 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <8a324b12-4774-4a73-9e6e-c2b87d80f4e8@googlegroups.com> Subject: Re: GPS: Including C headers from paths which are not configured in Source_Dirs From: "Rego, P." Injection-Date: Thu, 08 Oct 2015 16:51:58 +0000 Content-Type: text/plain; charset=ISO-8859-1 X-Received-Bytes: 2929 X-Received-Body-CRC: 9582900 Xref: news.eternal-september.org comp.lang.ada:27940 Date: 2015-10-08T09:51:58-07:00 List-Id: On Thursday, October 8, 2015 at 12:29:32 PM UTC-3, Simon Wright wrote: > package Compiler is > for Switches ("C") use ("-I/your/include/dir"); > end Compiler; It did not work, maybe I did wrong. I built a test code to analyze better. --test.gpr project Test is for Languages use ("Ada", "C"); for Source_Dirs use ("."); for Main use ("ohmy.adb"); package Compiler is for Switches ("C") use ("-Ioutsiders"); end Compiler; end Test; --ohmy.adb procedure Ohmy is procedure Put_Ohmy; pragma Import (C, Put_Ohmy, "putOhmy"); begin Put_Ohmy; end Ohmy; --bla.h void putOhmy(void); --bla.c #include #include "common/bla_other.h" void putOhmy (void) { putOhmyOther(); } --outsiders/common/bla_other.h void putOhmyOther(); --outsiders/common/bla_other.c #include #include void putOhmyOther(){ printf("Ohmy"); } In this case, the built returns the error message: > gprbuild -d -Ptest.gpr ohmy.adb > gcc ohmy.o -o ohmy.exe > libtest.a(bla.o):bla.c:(.text+0x7): undefined reference to `putOhmyOther' > collect2.exe: error: ld returned 1 exit status > gprbuild: link of ohmy.adb failed > [2015-10-08 13:38:54] process exited with status 4, 100% (2/2), elapsed time: 03.94s Realize that the folder 'outsiders' is included in project, so (I guess) its subfolders should be accessible by an include like '#include "common/bla_other.h"' (?) So what did I do wrong? Thanks. > > But why are you using #include "tools/mytool.h" rather than #include > ? (I've never understood why VxWorks uses this style). Actually I don't know. It's a (big) legacy code, so I'd rather not changing this (if possible).