Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Compiling C with C++ header files and libraries
Index -> Programming, C -> C Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Phoxy




PostPosted: Tue Jun 25, 2013 10:13 pm   Post subject: Compiling C with C++ header files and libraries

Hey guys, I am a veteran well -- aside from that. I love C and it is all I ever loved. Since C++11, I was scarred. I hated it, and I love working with C. Though the new functions and syntax in C++ are so nice and easy. My question that I want to ask here today is this. Is it possible in any way, like I know this sounds sort of "impossible" but can someone provide me with some extreme or simple method that I need to take to compile C code with C++ functions/syntax. I know this sounds extremely bizarre, but I hate C++ but some of the IP/Internet Handles in libraries like netdb.h or comm32.h or even inet32.h have symtax that I want to use... but simply because I am writing with .c extensions I cannot compile them. Is it possible to write in C but use both C and C++ syntax? I really want to be able to do this very badly. My husband would be able to help me, though he is a Java/J2EE kinda guy. Anyone here would happen to know a way to make this possible -- let me know. Thanks!

~ Phoxy
Sponsor
Sponsor
Sponsor
sponsor
DemonWasp




PostPosted: Tue Jun 25, 2013 11:09 pm   Post subject: RE:Compiling C with C++ header files and libraries

If you use a C++ compiler, then you will be able to compile code that uses C++ header files and libraries. This will not prevent you from writing code that LOOKS like C code. The languages are subtly different in how they handle C-like code, but you should be able to pick up on that. You'll have to change your *.c files to *.C or *.cc or *.cpp or whatever.

I'm not sure I understand why you really want to do this, though. There are valid reasons for wanting to use C (the language) rather than C++, but none of them make sense in the face of wanting to use "C++ syntax".

Also, I'm pretty sure netdb.h is a C header file. I couldn't find any source for 'comm32.h' or 'inet32.h', though.

What exactly are you trying to build, and why do you not want to use C++?
Display posts from previous:   
   Index -> Programming, C -> C Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: