Thread View: gnu.g++.help
2 messages
2 total messages
Started by Jason Rosenberg
Tue, 15 Sep 1992 18:45
inlines in .cc files?
Author: Jason Rosenberg
Date: Tue, 15 Sep 1992 18:45
Date: Tue, 15 Sep 1992 18:45
16 lines
1146 bytes
1146 bytes
Well, I guess you can't declare inline functions in .cc files, only in
.h files. Is this correct? It makes sense, otherwise how would
incremental compiling work....
Anyway, I inadvertently did this, and had an undefined symbol problem.
The functions I declared as inline came up undefined during linking.
I took off the inline declaration, and it compiles now. If that was the
problem, perhaps it would be a nice addition to add a compiler error
message saying no inlines.....
--
Jason Rosenberg Computer Science Department
jason@cs.ucla.edu University of California
{uunet,rutgers,ucbvax}!ucla-cs!jason Los Angeles, CA 90024
Re: inlines in .cc files?
Author: Warwick Allison
Date: Wed, 16 Sep 1992 03:15
Date: Wed, 16 Sep 1992 03:15
26 lines
1383 bytes
1383 bytes
jason@lanai.cs.ucla.edu (Jason Rosenberg) writes:
>Well, I guess you can't declare inline functions in .cc files, only in
>.h files. Is this correct? It makes sense, otherwise how would
>incremental compiling work....
You CAN use inlines in .cc files, but only for statically used functions.
GCC acts perfectly.
If you define an inline function in .cc files, no symbol is ever generated
by the compiler (obviously, since no separate function exists). Similarly,
when declared in a .h file, no symbol is created. Remember, .h files are
nothing special, they are just textually included into the .cc files. I'm
not sure the compiler proper ever even looks at actual .h files, since they
should be merged in by the pre-processor.
--
Warwick
--
_-_|\ warwick@cs.uq.oz.au /Disclaimer:
/ * <-- Computer Science Department, /
\_.-._/ University of Queensland, / C references are NULL && void*
v Brisbane, Australia. /
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads