Error in using ams { } with C++.

J

jakkem

For example the following gives me error
"expected `(' before '{' token"
"expected asm body before '{' token "
etc.

int main()
{
asm { /* some asm-functions */ }
}
 
L

Larry I Smith

For example the following gives me error
"expected `(' before '{' token"
"expected asm body before '{' token "
etc.

int main()
{
asm { /* some asm-functions */ }
}

You didn't say which compiler you are using (the rules vary).

For example, using the GCC compiler suite it's:

asm ( /* multiple lines of assembler code */ );

If the -ansi compile switch is specified, then 'asm' is not
allowed (by ANSI), so you have to use the (GCC specific)
__asm__ keyword in place of the asm keyword.

Your compiler may vary...

Larry
 
L

Larry I Smith

Larry said:
You didn't say which compiler you are using (the rules vary).

For example, using the GCC compiler suite it's:

asm ( /* multiple lines of assembler code */ );

If the -ansi compile switch is specified, then 'asm' is not
allowed (by ANSI), so you have to use the (GCC specific)
__asm__ keyword in place of the asm keyword.

Your compiler may vary...

Larry

Microsoft Visual Studio 2005 uses __asm {}, 'asm' is ignored.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top