LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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-19-2003, 10:55 AM   #1
usr
Member
 
Registered: Oct 2003
Posts: 44

Rep: Reputation: 15
problem in C++


I tried to include some assembly code into C++ but I didn't worked.
In Windows all is just fine but with this code in test.cpp:

#include <iostream>

using namespace std;

int main()
{
char *a="this is a message";
int len=strlen(a);
_asm{
//some assembly code
}
return 0;
}

when "g++ -o test test.cpp" I receive an error telling me he doesn't know what "_asm" is.
Could someone tell me how could I correct this?

Thanks!
 
Old 12-19-2003, 12:08 PM   #2
LogicG8
Member
 
Registered: Jun 2003
Location: Long Island, NY
Distribution: Gentoo Unstable (what a misnomer)
Posts: 380

Rep: Reputation: 30
This link will help you out a lot.
http://cs.wwc.edu/~aabyan/Unix/Assembly.html
 
Old 12-20-2003, 12:11 AM   #3
magicvash
Member
 
Registered: Aug 2003
Location: Chicago
Distribution: Mandrake 9.1 (x86)
Posts: 62

Rep: Reputation: 15
If I'm not mistaken, _asm is a VC++ macro so g++ has no idea what you're talking about. To do this, just put the asm code in a .asm file, use nasm to assemble the code to a .o file and then use g++ -c to compile your c++ code and then use g++ -o outfile obj1.o obj2.o asmbleycode.o cpluspluscode.o main.o (etc...whatever, howevery many files you have) to make the final executable binary
 
  


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
perl problem? apache problem? cgi problem? WorldBuilder Linux - Software 1 09-17-2003 07:45 PM

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

All times are GMT -5. The time now is 10:49 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