By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,986 Members | 2,030 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,986 IT Pros & Developers. It's quick & easy.

[Linker Error] Unresolved external 'function_name... using assemby code

P: 6
Hello!
im trying to run a project in c++ Builder (windos) that uses assembly code.
i assembly the code with ml.exe, then i have a .obj
i add this .obj to the project

then in a .cpp i write

Expand|Select|Wrap|Line Numbers
  1. extern estados(char *, char *, char *, int, int)
  2.  
and then i try to call this function just as my teachers teach me to do
and appears that:
[Linker Error] Unresolved external 'estados(char *, char *, char *, int, int)' referenced from C:\REDE\MAINUNIT.OBJ

it's the first time i use assembly soutines in c++ so i don't really know what to do, but this is what a saw in every places i looked for.
i think it could be a compiler option that i don't know or something like that.

Thanks
Jun 12 '07 #1
Share this Question
Share on Google+
4 Replies


P: 94
I know that when using normal C++ and header files, getting that error would indicate that the file just doesn't see the source .cpp file
So just include that
#include "file.cpp"
Jun 12 '07 #2

weaknessforcats
Expert Mod 5K+
P: 9,197
This is not correct:

know that when using normal C++ and header files, getting that error would indicate that the file just doesn't see the source .cpp file
So just include that
#include "file.cpp"
You do not #include source files. If a program has multiple source files and you #include "file.cpp" in each file you will die in the link with redefinition errors.

What you should do is put the function prototype in the first source file and add the second source file to the build. If you are using a tool with projects, this means adding the second source file to the project.

You can put the function prototype in the header file and then #include the header file. This helps where many source files need that function prototytpe.
Jun 13 '07 #3

P: 6
thanks for the replies.
But the problem is that there's no .cpp file with the implementation of the function. The function is implemented in a .asm file. Then i assembly the code to obtain a .obj.
I have solved the problem jet by making a C project and without making changes in the code at all, but i want to use C++.
if anyone knows hot to do that in another compiler could help me to.
i may should start another discussion
Jun 13 '07 #4

weaknessforcats
Expert Mod 5K+
P: 9,197
How have you added the .obj of the .asm file to your C project??

The same should work for your C++ project.

Most of these tools allow files in projects to be a mixture of .c and .cpp. The .c files are compiled using C and the .cpp files compiled using C++.

That is, a C++ project ddoes not need all the source files to be .cpp files.
Jun 14 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.