Click here to Skip to main content
15,922,533 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a project with some libraries compile by C. I want to convert those libraries to my project. How to convert for it ? If I until compile this project then I receive some error the following :


chapters.obj : error LNK2019: unresolved external symbol "void __cdecl write_chapters_simple(int &,class libmatroska::KaxChapters *,class mm_io_c *)" (?write_chapters_simple@@YAXAAHPAVKaxChapters@libmatroska@@PAVmm_io_c@@@Z) referenced in function __catch$?extract_chapters@@YAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_NW4parse_mode_e@kax_analyzer_c@@@Z$0


Can your help for me to solver this problem

Thanks !
Posted
Updated 28-Jun-11 16:55pm
v2

1) ensure you pull all your required code to your source directory.(source file build) or include external include files in the project.
2) If you have external *.lib accessed code, ensure you link the library in linker.

All those errors that you got in your post is because the linker was unable to find those functions. neither the source nor the library it could find for your function write_chapters_simple.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 28-Jun-11 23:55pm    
This is a useful reminder, but not to the point of the problem.

Please see my answer -- I maintain that "conversion" (OP means translation) makes little to no sense.
--SA
harish85 29-Jun-11 1:32am    
Yes correct Thanks, I guess OP was availing some C functions in his C++ project, and he was having hard time linking them, as u well said it should be translation or just using.
Thanks for the correction...
"Conversion" like that may only make sense if you change C non-OOP code to C++ OOP with classes and virtual function, but it would be rather re-writing, not "conversion" (you should better call it "translation").

If you don't want to do that, the translation also makes no sense, as you can freely mix C++ and C source code files in your C++ project.

Good luck,
—SA
 
Share this answer
 
v2
Comments
dung 6-Jul-11 22:51pm    
Hi SAKryukov,
Thanks you answer for me, I had fix a error above. I'm trying order directories and build all my solution (MKVToolnix v.4.8.0). Each project in solution is success if I build independent but when I build a project with name (Extract) and output file format to (.exe) then error occur here and receive the following :

.....
7>------ Rebuild All started: Project: extract, Configuration: Debug Win32 ------
7>Deleting intermediate and output files for project 'extract', configuration 'Debug|Win32'
7>Compiling...
7>attachments.cpp
7>chapters.cpp
7>cuesheets.cpp
7>extract_cli_parser.cpp
7>mkvextract.cpp
7>options.cpp
7>tags.cpp
7>timecodes_v2.cpp
7>track_spec.cpp
7>tracks.cpp
7>xtr_aac.cpp
7>xtr_avc.cpp
7>xtr_avi.cpp
7>xtr_base.cpp
7>xtr_cpic.cpp
7>xtr_mpeg1_2.cpp
7>xtr_ogg.cpp
7>xtr_pgs.cpp
7>xtr_rmff.cpp
7>xtr_textsubs.cpp
7>Generating Code...
7>Compiling...
7>xtr_tta.cpp
7>xtr_vobsub.cpp
7>xtr_wav.cpp
7>Generating Code...
7>Compiling resources...
7>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
7>Copyright (C) Microsoft Corporation. All rights reserved.
7>Linking...
7>common.lib(ebml.obj) : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification
7>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __heap_alloc already defined in LIBCMT.lib(malloc.obj)
7>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __recalloc already defined in LIBCMT.lib(recalloc.obj)
7>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __msize already defined in LIBCMT.lib(msize.obj)
7>LIBCMTD.lib(malloc.obj) : error LNK2005: _V6_HeapAlloc already defined in LIBCMT.lib(malloc.obj)
7>LIBCMTD.lib(dbghook.obj) : error LNK2005: __crt_debugger_hook already defined in LIBCMT.lib(dbghook.obj)
7>LIBCMTD.lib(sbheap.obj) : error LNK2005: __get_sbh_threshold already defined in LIBCMT.lib(sbheap.obj)
7>LIBCMTD.lib(sbheap.obj) : error LNK2005: __set_sbh_threshold already defined in LIBCMT.lib(sbheap.obj)
7>LIBCMTD.lib(sbheap.obj) : error LNK2005: __set_amblksiz already defined in LIBCMT.lib(sbheap.obj)
7>LIBCMTD.lib(sbheap.obj) : error LNK2005: __get_amblksiz already defined in LIBCMT.lib(sbheap.obj)
7>LIBCMTD.lib(sbheap.obj) : error LNK2005: ___sbh_heap_init already defined in LIBCMT.lib(sbheap.obj)
7>LIBCMTD.lib(sbheap.obj) : error LNK2005: ___sbh_find_block already defined in LIBCMT.lib(sbheap.obj)
7>LIBCMTD.lib(sbheap.obj) : error LNK2005: ___sbh_free_block already defined in LIBCMT.lib(sbheap.obj)
7>LIBCMTD.lib(sbheap.obj) : error LNK2005: ___sbh_alloc_block already defined in LIBCMT.lib(sbheap.obj)
7>LIBCMTD.lib(sbheap.obj) : error LNK2005: ___sbh_alloc_new_region already defined in LIBCMT.lib(sbheap.obj)
7>LIBCMTD.lib(sbheap.obj) : error LNK2005: ___sbh_alloc_new_group already defined in LIBCMT.lib(sbheap.obj)
7>LIBCMTD.lib(sbheap.obj) : error LNK2005: ___sbh_resize_block already defined in LIBCMT.lib(sbheap.obj)
7>LIBCMTD.lib(sbheap.obj) : error LNK2005: ___sbh_heapmin already defined in LIBCMT.lib(sbheap.obj)
7>LIBCMTD.lib(sbheap.obj) : error LNK2005: ___sbh_heap_check already defined in LIBCMT.lib(sbheap.obj)
7>LIBCMTD.lib(sbheap.obj) : error LNK2005: ___sbh_pHeaderDefer already defined in LIBCMT.lib(sbheap.obj)
7>LIBCMTD.lib(isctype.obj) : error LNK2005: __isctype_l already defined in LIBCMT.lib(isctype.obj)
7>LIBCMTD.lib(isctype.obj) : error LNK2005: __isctype already defined in LIBCMT.lib(isctype.obj)
7>MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _malloc already defined in LIBCMT.lib(malloc.obj)
7>MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _realloc already defined in LIBCMT.lib(realloc.obj)
7>MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _toupper already defined in LIBCMT.lib(toupper.obj)
7>MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _free already defined in LIBCMT.lib(free.obj)
7>MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _calloc already defined in LIBCMT.lib(calloc.obj)
7>MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _ldexp already defined in LIBCMT.lib(_ldexp_.obj)
7>MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _memmove already defi
Sergey Alexandrovich Kryukov 8-Jul-11 0:53am    
Those are linker errors, looks like different versions of the same library are attempted to link. I feel blindfolded. Do you have any variant of solution which compiles, let it be C only? VS project file(s) for it? Can you leave C code and create a DLL out of it. Back to my idea, why making C++ fro C at all, why not use C? If you not introducing decent C++ features in code formal translation into C++ makes no sense.
--SA

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