473,395 Members | 1,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

C not compatible with C++?

Hi,

I have a perfectly working application written to connect to a PBS
server and link against the PBS library. However, today I tried
switching to C++ and the same code doesn't compile! (with any compiler).
Please note that this is not a question about what or which compiler to
use.. I'm only curious.. why would my code not link against a C compiler
library? (For those curious, I've tried g++ and icc). It keeps giving me
an undefined symbol. Whereas changing the extension from .cpp to .c works!!

Thanks

Steve

Jul 22 '05 #1
4 1165
"Steve" <nospam@nopes> wrote...
I have a perfectly working application written to connect to a PBS
server and link against the PBS library. However, today I tried
switching to C++ and the same code doesn't compile! (with any compiler).
Please note that this is not a question about what or which compiler to
use.. I'm only curious.. why would my code not link against a C compiler
library? (For those curious, I've tried g++ and icc). It keeps giving me
an undefined symbol. Whereas changing the extension from .cpp to .c

works!!

FAQ 5.8.
Jul 22 '05 #2
Steve wrote:

Hi,

I have a perfectly working application written to connect to a PBS
server and link against the PBS library. However, today I tried
switching to C++ and the same code doesn't compile! (with any compiler).
Please note that this is not a question about what or which compiler to
use.. I'm only curious.. why would my code not link against a C compiler
library? (For those curious, I've tried g++ and icc). It keeps giving me
an undefined symbol.
Does it not compile or does it not link? If it is the latter then you
probably have a mismatch in the language linkage. Use extern "C". This
seems to be covered by FAQ 32.
http://www.parashift.com/c++-faq-lite/
Whereas changing the extension from .cpp to .c works!!


It is common practice for [at least] some C++ compilers to assume that *.c
files contain C rather than C++.

Denis
Jul 22 '05 #3
Steve wrote:
Hi,

I have a perfectly working application written to connect to a PBS
server and link against the PBS library. However, today I tried
switching to C++ and the same code doesn't compile!


I don't see why it would... C and C++ are different languages. C++ is
not even a proper superset of C.

Your FORTRAN code probably won't compile with your C++ compiler either, BTW.

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.
Jul 22 '05 #4
Kevin Goodsell <us*********************@neverbox.com> wrote in message news:<u2***************@newsread2.news.pas.earthli nk.net>...
Steve wrote:
Hi,

I have a perfectly working application written to connect to a PBS
server and link against the PBS library. However, today I tried
switching to C++ and the same code doesn't compile!


I don't see why it would... C and C++ are different languages. C++ is
not even a proper superset of C.

Your FORTRAN code probably won't compile with your C++ compiler either, BTW.


However, the intersection of C and C++ is large enough to write programs
in. The intersection of FORTRAN and C++ is for showing off.
Jul 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: R. Rajesh Jeba Anbiah | last post by:
Kinda OT. I haven't yet moved to PHP5. But, interested to know how many of you _really_ started using it or moved? Are you doing any compatible tweaks specifically for PHP 5 (forward compatible) or...
1
by: dkomo | last post by:
I wrote a VB 6.0 program to create an Access database file and fill it with data. I used the following DAO statement: Set db_AllEquity = ws.CreateDatabase(Database_Name, dbLangGeneral,...
5
by: Leif K-Brooks | last post by:
I need to do some simple image editing (pretty much just scaling) in a GPLed program. Unfortunatly, both of the Python libraries for image editing that I found (gdmodule and PIL) are under the...
0
by: Lee Gillie | last post by:
We have systems built upon shared libraries, which are maintained by a group of programmers. We install these to the GAC on production servers. For saftey, when a programmer uses one of these...
9
by: bert76 | last post by:
can anyone suggest a couple of websites providing *compatible* javascript? of course there is http://javascript.internet.com/ http://javascriptkit.com/ and the likes, but time and again you have...
11
by: Kristoffer Arfvidson | last post by:
HI! I have a question.... when designing asp.net pages in vs.net I always see that labels are transformed to <span tags... I stopped using span and div before because of its lack of compatibility...
5
by: max | last post by:
Dear all, I did the following analysis to conclude that the following pointer types are not compatible. Please let me know If my analysis and interpretation of the C standard are correct: ...
5
by: P | last post by:
I was wondering what sort of changes I need to make in order to make an application to be DEP compatible with on Windows XP x64 version 2003. I have compiled an open source C application...
2
by: gordon | last post by:
hi in my application a file selection by user returns a pathname string like F:/images/png/my.png or F:/docs/text/somedoc.txt ....etc. I can get the extension using...
1
by: Nathan Sokalski | last post by:
On Microsoft's page about IE8 and Defining Document Compatibility at: http://msdn.microsoft.com/en-us/library/cc288325(VS.85).aspx They give the following code to add to Web.config: <?xml...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.