![]() |
compiling .c and .cpp files altogether ?
I've realized my old dream: porting all my bot source code to ANSI C. It's now all .c files, at the exception of interface.cpp which contains the HL engine interfacing functions and stuff.
But the problem, is that the linker can't seem to find external variables and functions in both situations! I mean that when something is declared in a .c file it can't be accessed from the .cpp file (even if you declare it extern) and vice versa... look at the output Quote:
|
Re: compiling .c and .cpp files altogether ?
Maybe you have to wrap your C files like this:
Code:
#ifdef cplusplus |
Re: compiling .c and .cpp files altogether ?
sfx I love you!
erm, right. In the very spiritual sense of the term, I mean :| btw, it's not cplusplus but __cplusplus. |
Re: compiling .c and .cpp files altogether ?
I put cplusplus. So, it worked then?
|
Re: compiling .c and .cpp files altogether ?
Yeah, but instead of wrapping all the .c files with it, I only needed to wrap the function prototypes and the global variables declarations. All the rest can remain unchanged.
Thanks for the hint, anyway :) |
Re: compiling .c and .cpp files altogether ?
Well, I had no clue if it was going to work or not, but I remembered it was in Botman's patches for GCC.
|
All times are GMT +2. The time now is 12:19. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.