Click here to Skip to main content
15,889,808 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
u want to call function from c++ in nasm in this function I declare object from class

What I have tried:

I tried this code in nasm file
extern kmain
and this code in c++ file
extern "c++" kmain ;
but it's don't solve the problem
and always I get this error message
undefined reference to _kmain
Posted
Updated 29-Sep-19 2:14am

1 solution

You need to use extern "C", not C++ in order to get the correct external name defined. C++ names include special characters and are not easy to predict.
 
Share this answer
 
Comments
Member 14160360 29-Sep-19 11:24am    
thanks for reply I tried your solution but it's don't solve the problem and I get same error message
Richard MacCutchan 29-Sep-19 11:36am    
Please edit your question and show the code that is causing the problem.
Member 14160360 29-Sep-19 11:55am    
I found solution by myself and the wrong thing is I write in nasm file extern _kmain any way thank you again

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900