Kumar
Kumar

Reputation: 237

gcc compiler lib file not found error

Please help me on the gcc compiler command

gcc -c -ID:\pjtName\lib -c -fprofile-arcs -ftest-coverage D:\pjtName\source\tmp.ada

I am trying to compile the tmp.ada with coverage. adb and ads files are located in D:\pjtName\source folder. and my lib files are located in D:\pjtName\lib folder.

The problem is gcc is not locates tmp.ads file and the library files in the D:\pjtName\lib folder. it show file not found error

after this command i need to run gcov command for the tmp.ada file

Upvotes: 0

Views: 998

Answers (2)

user2074102
user2074102

Reputation:

As was stated above, don't use gcc.

I usually use gnat compile filename.adb then use gnat bind filename.ali, then gnat link filename.ali -Lexternaldirectory -lexternallib

Upvotes: 0

Simon Wright
Simon Wright

Reputation: 25491

GNAT’s build process is complicated. gcc is really too low-level a tool to use easily; instead, use gnatmake and GNAT project files.

You’ve tagged gnat-gps, so I assume you actually have GPS. If that’s so, your best bet would be, when opening GPS, to select Create new project with wizard and go on from there. If you get stuck, use GPS’s included help or come back here.

To get coverage information with GPS, you go to Edit / Edit Project Properties and

  • in the Ada tab, select Code coverage and Instrument arcs, which includes -ftest-coverage and -fprofile-arcs;
  • in the Ada Linker tab, select Code coverage, which includes -fprofile-generate (you get link time errors otherwise).

By the way, you mention a file tmp.ada; it’s best to stick with .ads for specs and .adb for bodies. GNAT does its best, but if your other code includes with Tmp; GNAT will look for tmp.ads. You can alter this behaviour, but why bother unless you have to for other reasons!

Upvotes: 2

Related Questions