Dev C++ inline assembly error messages

Started by
17 comments, last by nick22891 16 years, 9 months ago
I just started using inline assembly with dev c++ and it was going fine for the simple arithmetic operations. I just tried using the 'shr' instruction and after painstakingly getting the syntax right(AT&T) it tels me "[linker error] undefined reference to '__cpu_features_init'. What caused this and how do i fix it? Am i doing something wrond or does Dev C++ just stink at inline assembly?
Advertisement
Hello, i would like to remind you that this is a forum not a chat, and you should wait at least 24 for hours for answer. Getting mad and yelling won't help here. Moreover you double-posted your topic.
Well, you posted 30 minutes ago. There has been 15 page views considering both your posts. So yeah, my guess is that no one that knows asembly has looked your post yet. For the record, I have no idea about how assembly works.

Also, complaining no one answered is not very polite, especially in such a short time span.
Sorry guys. I'm a chatroom addict so i guess i've grown impatient in some respects. Plus i'm new here. Didn't mean to double post by the way. I clicked refreshed because the page that came up was blank and that happened. I'll check back some other time.
I just discovered that dev won't compile anything anymore. It gives me the same error message i described before. Not even things written purely in C++> Please help!
Quote:Original post by nick22891
Sorry guys. I'm a chatroom addict so i guess i've grown impatient in some respects. Plus i'm new here. Didn't mean to double post by the way. I clicked refreshed because the page that came up was blank and that happened. I'll check back some other time.


He, don't worry, we all make mistakes sometimes. It's true that sometimes you will get answers pretty fast in this forum, but that will depend on how easy your question actually is. I mean, since you just replied to me, I really wanted to answer you, but the truth is I still have no idea of what is going on... so yeah, this may take a while.
Is there any special reason you are using Dev-C++ instead of Visual
Studio 2005 Express?
If not, you should consider switching to VS2k5EE (it's free), which as a
nice bonus uses Intel syntax for the inline assembly. :)

To make it is hell. To fail is divine.

Post a code sample. Inline ASM syntax in gcc is very, very different to MSC syntax, and I don't mean AT&T vs Intel only.

Also, just a note, since you don't make any mention of why is it that you're using inline asm, you need to pass the -msse, -msse2 or -msse3 in order for the compiler to recognize SSE instructions.


you can set the asm dialect with -masm=intel, check other compiler flags here

[Edited by - Kwizatz on June 30, 2007 6:08:23 PM]
Did you try googling on '__cpu_features_init'? The suggestion here is to update your copy of the compiler ("an outdated mingw version").

One trick for compiling a list of inline assembler errors in order to look them up when needed is to examine the exe of compiler and the exe of the linker in hex editor and extract the strings it contains. Or you could use a utility like TextScan to do the same thing.

It's also helpful to have the gas manual at hand. If you're running windows, you can find it in .chm format here. It's a little bit outdated, but not so much that it will cause problems with simpler tasks.

The files to look for are

as-2.14.chm
cppinternals-3.3.2.chm
cpp-3.3.2.chm
gcc-3.3.2.chm
gccint-3.3.2.chm

and

gdb-6.0.chm
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
I've heard that the syntax for usind Microsoft Visual C++ is more complicated and i tried putting the code that compiled in dev c++ in it and it gave me some weird error messages. If the syntax is different can someone tell me what the differences are so i can switch? If they aren't different i guess i'll just try again.

P.S. Thanks for all the advice ppl.

This topic is closed to new replies.

Advertisement