Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am new at c++, and ;I am trying to use existing library that contains .c and .h files.This library also contain one test program.I have included all .c and .h files to my project. When i try to build my project I get the about 10 different "LNK2019: unresolved external symbol errors". maybe some one can help me figure this out.I have checked that .c and .h files contain these function i-e mzd_copy,mzd_echelonize_m4ri etc. I am using visual studio C++ .net 2008. I have uploaded my project at mediafire
http://www.mediafire.com/?6bcuo1tmg3smysc
the error i received are as follows:

Error   7   error LNK2019: unresolved external symbol _mzd_copy referenced in function "int __cdecl elim_test_equality(int,int)" (?elim_test_equality@@YAHHH@Z) test_elimination.obj
Error   6   error LNK2019: unresolved external symbol _mzd_echelonize_m4ri referenced in function "int __cdecl elim_test_equality(int,int)" (?elim_test_equality@@YAHHH@Z)  test_elimination.obj
Error   4   error LNK2019: unresolved external symbol _mzd_echelonize_naive referenced in function "int __cdecl elim_test_equality(int,int)" (?elim_test_equality@@YAHHH@Z) test_elimination.obj
Error   3   error LNK2019: unresolved external symbol _mzd_echelonize_pluq referenced in function "int __cdecl elim_test_equality(int,int)" (?elim_test_equality@@YAHHH@Z)  test_elimination.obj
Error   2   error LNK2019: unresolved external symbol _mzd_equal referenced in function "int __cdecl elim_test_equality(int,int)" (?elim_test_equality@@YAHHH@Z)    test_elimination.obj
Error   1   error LNK2019: unresolved external symbol _mzd_free referenced in function "int __cdecl elim_test_equality(int,int)" (?elim_test_equality@@YAHHH@Z) test_elimination.obj
Error   9   error LNK2019: unresolved external symbol _mzd_init referenced in function "int __cdecl elim_test_equality(int,int)" (?elim_test_equality@@YAHHH@Z) test_elimination.obj
Error   8   error LNK2019: unresolved external symbol _mzd_randomize referenced in function "int __cdecl elim_test_equality(int,int)" (?elim_test_equality@@YAHHH@Z)    test_elimination.obj
Error   5   error LNK2019: unresolved external symbol _mzd_top_echelonize_m4ri referenced in function "int __cdecl elim_test_equality(int,int)" (?elim_test_equality@@YAHHH@Z)  test_elimination.obj
Error   10  fatal error LNK1120: 9 unresolved externals C:\Users\Ishtiaq\Documents\Visual Studio 2008\Projects\test333\Debug\test333.exe
Posted

I downloaded your project and made it compile.

1- add ALL files to your solution (*.c and *.h files). Your solution only contains one .c file...
2- inline keyword cannot be used in *.c files with Visual Studio. So rename all your *.c files into *.cpp files.
3- edit the m4ri.h file and comment the __cplusplus block out.

C#
/*
#ifdef __cplusplus
extern "C" {
#endif //__cplusplus
*/
#include "permutation.h"
#include "packedmatrix.h"
#include "brilliantrussian.h"
#include "strassen.h"
#include "grayflex.h"
#include "parity.h"
#include "trsm.h"
#include "pls.h"
#include "pls_mmpf.h"
#include "solve.h"
#include "echelonform.h"
/*
#ifdef __cplusplus
}
#endif //__cplusplus
*/
 
Share this answer
 
Comments
smishtiaqhussain 23-Feb-11 10:55am    
Thanks a lot for your help.
cheers
Olivier Levrey 23-Feb-11 11:20am    
You're welcome.
Sergey Alexandrovich Kryukov 23-Feb-11 22:47pm    
Heroic effort :-) my 5.
--SA
Olivier Levrey 24-Feb-11 4:20am    
Thanks :)
Looks like you forgot to link a library to your code.
 
Share this answer
 
Are you sure you included all the .c++ files and that the class containing the fn, _mzd_copy() has it defined in the corresponding .h files. Check whether there is any additional dependency needed, like some dll or lib. to run it.
 
Share this answer
 
yah i am pretty sure i added all the libraries to my project. All files are .c and .h files. there are no .lib and .dll files associated.

http://www.mediafire.com/file/6bcuo1tmg3smysc/test333.rar[^]

If u aren't able to access the source project. here is the link again. :)


Thanks a bunch

Peace :)
 
Share this answer
 

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