LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-23-2005, 03:17 AM   #1
lucky6969b
Member
 
Registered: Nov 2005
Posts: 337

Rep: Reputation: 30
expected ';' before "extern"


This is a C++ Linux cross-compilation topic. OT although if you'd love to
help. I enjoy to get quick responses in Microsoft groups.
I tried to overcome the data-mangling problem with extern "C" { };

This project is to cross-compile a PC Linux Program onto ARMBE-Linux.
Everything went fine on the PC Compilation, only the cross-compiler didn't.

I resolved basically everything by embracing the C++ functions inside extern
"C", but the following error occurred, the very last error to succeed

expected ';' before extern

My code is like this
extern "C" {
CURL *curl_handle
};

extern "C" {
.... and all sorts of Curl specific functions
};
Thanks
Jack
 
Old 12-23-2005, 03:18 AM   #2
lucky6969b
Member
 
Registered: Nov 2005
Posts: 337

Original Poster
Rep: Reputation: 30
Of course this is a cloned message. Microsoft just accidentally included
 
Old 12-23-2005, 03:36 AM   #3
lucky6969b
Member
 
Registered: Nov 2005
Posts: 337

Original Poster
Rep: Reputation: 30
anther thing is primary expression before "extern"
 
Old 12-23-2005, 11:10 AM   #4
deiussum
Member
 
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Rep: Reputation: 32
I don't quite understand what you are saying in your last 2 responses...

More code would be nice. It looks to me like you are missing a ; BEFORE your extern. Either in the same file or in a header file included beforehand.

e.g. as a simple example the following code might generate that error:

Code:
const int a=0 // Note missing ;

extern "C"
{
// stuff here.
};

Last edited by deiussum; 12-23-2005 at 11:12 AM.
 
Old 12-23-2005, 07:19 PM   #5
lucky6969b
Member
 
Registered: Nov 2005
Posts: 337

Original Poster
Rep: Reputation: 30
The whole error message is

Primary expression before "extern"
expected ';' before extern

I'll post some code later
Thanks in advance
 
Old 12-23-2005, 09:55 PM   #6
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
1. As you know, the goal in "extern "C" is so that functions declared in C++ (but wrapped in the "extern C") will have C linkage (i.e. will NOT have C++ name mangling).

2. You'll probably make the declaration in a header. And you'll probably want the header to be compiled under EITHER C++ OR C.

3. To compile "extern C" under straight C, however, you'll need to turn on your cloaking shields.

EXAMPLE:
less /usr/include/pcre.h =>
Code:
#ifdef __cplusplus
extern "C" {
#endif
...
#ifdef __cplusplus
}  /* extern "C" */
#endif
The macro "__cplusplus" is guaranteed to be defined for any C++ compiler.

'Hope that helps .. PSM
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
C: "or"(||) not functioning as expected in while loop mlaich Programming 4 12-04-2005 02:13 AM
"who" not giving the expected result rblampain Linux - Newbie 2 11-17-2004 04:06 AM
Java "<identifier> expected" error. nro Programming 2 09-01-2004 12:20 AM
extern "C" and static data type problem with g++ vtluu Red Hat 1 05-21-2004 10:45 AM
extern "C" and static data type problem with g++ vtluu Programming 2 04-28-2004 05:10 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration