From: mojtaba mahdavi <mahdavi110@gmail.com>
To: linux-c-programming@vger.kernel.org
Subject: Windows can use cpp in c code but in linux ?? I dont know how.
Date: Thu, 30 Sep 2004 14:20:55 +0330 [thread overview]
Message-ID: <36a2bb3d04093003501d1b58a7@mail.gmail.com> (raw)
Hi all.
I am a windows programmer and want to migrate my codes to linux.
My problem is as followes.
I want to use cpp (File1.cpp) codes in c (File2.c) codes.
in windows I have done following and it is ok.
1- I wrote a cpp code (Wrap.cpp) that wraps my cpp code (File1.cpp) and
compiled it using cpp compiler.
( my strategy: for every method I wrote a c function that calls the methode.
each function gets a void * to the class handle and ... )
2- I exported my wrapper functions as C interfaces using extern "C". (Wrap.h)
3- in File2.c I used wrap.h and compiled it as a c code. every thing is fine.
Now I have trouble with linux to do that (because I am a newbie in linux).
at first, is it possible in linux ?? ( I think it must be possible ).
secondly, How do I it.
actually I have done above in linux but I got some error message.
My strateghy is as follows.
1- complie file1.cpp and wrap.cpp using gcc and making file1.o and
wrap.o. it is ok.
2- making library using ar command. it is ok. (mylib.a)
3- compile and link file2.c with mylib.a ..???????!!!!!!!!
this generates an error.
it says :
./libmylib.a(wrap.o)(.text+0xc):wrap.cpp: undefined reference to `
___gxx_personality_sj0'
./libmylib.a(wrap.o)(.text+0x44):wrap.cpp: undefined reference to
`operator new(unsigned)'
./libmylib.a(wrap.o)(.text+0x85):wrap.cpp: undefined reference to
`operator delete(void*)'
./libmylib.a(wrap.o)(.text+0xeb):wrap.cpp: undefined reference to
`operator delete(void*)'
collect2: ld returned 1 exit status
NOW.
what should I do ????
next reply other threads:[~2004-09-30 10:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-30 10:50 mojtaba mahdavi [this message]
2004-10-01 1:49 ` Windows can use cpp in c code but in linux ?? I dont know how Suciu Flavius
2004-10-02 5:47 ` mojtaba mahdavi
2004-10-02 15:37 ` Suciu Flavius
2004-10-02 6:39 ` mojtaba mahdavi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=36a2bb3d04093003501d1b58a7@mail.gmail.com \
--to=mahdavi110@gmail.com \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.