can #line directive dynamically resolve the file path?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, I have a question about #line directive. I have two files. a.c and b.c under my c:/ (I use Windows MinGW)

Now, I have a.c
---------------------------------------------
int main()
{
  #line 1 "b.c"
  int a
  return 0;
}
---------------------------------------------
and b.c
---------------------------------------------
int f1()
{
  return 0;
}
---------------------------------------------


Now, I try to run the command line:

C:\>gcc -c C:\a.c
b.c: In function 'main':
b.c:2:3: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'return'
C:\>

You can see, the gcc report error says there are some error in "b.c" but not "c:\b.c". which means gcc can not dynamically resolve the file path after the #line directive.

Though I can hard-coded the "c:/b.c" to the a.c file, but this is not a good solution because I would always move the code to other place.

My question is: Can any one give me an idea to solve this kind of problem?
thanks.


One reference is:
http://gcc.gnu.org/onlinedocs/cpp/Line-Control.html#Line-Control

asmwarrior






[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux