[cfe-dev] Why this extern "C" fails ?

Ólafur Waage olafurw at gmail.com
Mon Jul 29 07:06:35 PDT 2013


What is your compile line?


On Mon, Jul 29, 2013 at 1:56 PM, Arji Cot <arjicot at gmail.com> wrote:

> --------------
>
> #include <iostream>
>
> int main() {
>   {
>     extern "C" { int a = 42; }
>     { std::cout << a << "\n"; }
>   }
>   return (0);
> }
>
> --------------
>
> this code fails to compile and the compiler message alone
>
> main.cpp:5:12: error: expected unqualified-id
>     extern "C" { int a = 42; }
>            ^
> 1 error generated.
>
> It's not enough to me to explain why this is not working.
>
> There is something that I'm missing ?
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130729/77a5f484/attachment.html>


More information about the cfe-dev mailing list