- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I am justing using NIOS IDE for one day. I can compile/link C sources in IDE. I can also compile C++ sources, but linker complained "undedfined main", since I compile the source with the 'main' function in a C++ way (because the main function needs to access C++ programs. Any suggestion how to mix C codes with C++ classes? Regards, Kwok WongLink Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- originally posted by kwokwong@Jul 27 2004, 04:30 AM hi all,
i am justing using nios ide for one day.
i can compile/link c sources in ide. i can also compile c++ sources, but linker complained "undedfined main",
since i compile the source with the 'main' function in a c++ way (because the main function needs to access c++ programs.
any suggestion how to mix c codes with c++ classes?
regards,
kwok wong --- Quote End --- Problem solved: define C main function in C++ program extern "C" { int main() { // C++ codes } }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
FYI, you can also say:
extern "C" int main() {
// C++ codes
}
Might be a little easier on the eyes.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page