Regarding integration of two different projects
-
I have made Win32 project under Visual studio 2005. In this project I also included another project whose library needs to be used by my project. But the problem is that included project is written in core C and i am obviously having class based structure. So it is not allowing me to use library function of included project in my project. So how could i integrate these two projects? What configuration changes should i make under 2005? Any help is much appreciated. Thanks & Ragards, Hemang
-
I have made Win32 project under Visual studio 2005. In this project I also included another project whose library needs to be used by my project. But the problem is that included project is written in core C and i am obviously having class based structure. So it is not allowing me to use library function of included project in my project. So how could i integrate these two projects? What configuration changes should i make under 2005? Any help is much appreciated. Thanks & Ragards, Hemang
C++ projects can invoke C export functions, whereas C projects can not use C++ export functions and classes.
Maxwell Chen
-
C++ projects can invoke C export functions, whereas C projects can not use C++ export functions and classes.
Maxwell Chen
Thanks for replying. I know this fact. But my problem is of some different sort. Let me more precise on the matter. I am X.264 library for my project. This library has been generated using Msys and MinGW. I have included libx264.a in Additinal Dependencies tab. If i compile the included X.264 using C compile code in Linker/C-C++/Advanced/Compile As in project property page, then it is being compiled successfully, But if i compile as C++ then it gives me error. So what should i do? may i need to do any configuration changes for that under VS 2005? Thanks & Regards, Hemang
-
Thanks for replying. I know this fact. But my problem is of some different sort. Let me more precise on the matter. I am X.264 library for my project. This library has been generated using Msys and MinGW. I have included libx264.a in Additinal Dependencies tab. If i compile the included X.264 using C compile code in Linker/C-C++/Advanced/Compile As in project property page, then it is being compiled successfully, But if i compile as C++ then it gives me error. So what should i do? may i need to do any configuration changes for that under VS 2005? Thanks & Regards, Hemang
What are the error messages?
Maxwell Chen
-
What are the error messages?
Maxwell Chen
-
error LNK2019: unresolved external symbol "struct x264_t * __cdecl x264_encoder_open(struct x264_param_t *)
Hemang Raval wrote:
error LNK2019: unresolved external symbol "struct x264_t * __cdecl x264_encoder_open(struct x264_param_t *)
Because I don't have your source to view the whole relationship, I could only guess. Check the includes and / or prototypes for:
extern "C" {
#include "some_header"
};
// Or ...
extern "C" {
x264_t* x264_encoder_open(x264_param_t*); // C++ does not need to put the keyword struct.
}Maxwell Chen
-
Hemang Raval wrote:
error LNK2019: unresolved external symbol "struct x264_t * __cdecl x264_encoder_open(struct x264_param_t *)
Because I don't have your source to view the whole relationship, I could only guess. Check the includes and / or prototypes for:
extern "C" {
#include "some_header"
};
// Or ...
extern "C" {
x264_t* x264_encoder_open(x264_param_t*); // C++ does not need to put the keyword struct.
}Maxwell Chen
Ok thats same as my problem. Now i am posting my code I am having two projects in one solution: one is Test1 and another one is Test2 Test1 having two files Test1.h and Test1.c Test1.h
void testFunc();
Test1.c#include "Test1.h" void testFunc() { printf("In Function testFunc()"); }
Now Test2 Having Two Files Test2.h and Test2.cpp Test2.hclass Test2 { Test2(); }
Test2.cpp#include "Test2.h" #include "Test1.h" Test2::Test2() { testFunc(); }
Now i am compiling Test1 by c Compiler and Test2 by c++ compiler in "VS2005" so it is giving me linking error as below: error LNK2019: unresolved external symbol _testFunc referenced in function "public: __thiscall Test2::Test2(void)" (??0Test2@@QAE@XZ) So do you have any idea regarding this?? Please Give me any idea, i am stuck on it.Manish Patel. B.E. - Information Technology.
-
Ok thats same as my problem. Now i am posting my code I am having two projects in one solution: one is Test1 and another one is Test2 Test1 having two files Test1.h and Test1.c Test1.h
void testFunc();
Test1.c#include "Test1.h" void testFunc() { printf("In Function testFunc()"); }
Now Test2 Having Two Files Test2.h and Test2.cpp Test2.hclass Test2 { Test2(); }
Test2.cpp#include "Test2.h" #include "Test1.h" Test2::Test2() { testFunc(); }
Now i am compiling Test1 by c Compiler and Test2 by c++ compiler in "VS2005" so it is giving me linking error as below: error LNK2019: unresolved external symbol _testFunc referenced in function "public: __thiscall Test2::Test2(void)" (??0Test2@@QAE@XZ) So do you have any idea regarding this?? Please Give me any idea, i am stuck on it.Manish Patel. B.E. - Information Technology.
I just created two project: 1. C:\Tmp\Test1, in C, 2. C:\Tmp\Test2, in C++. Test2 uses Test1 functions. Steps: 1. Compile Test1 without worrying about Test2 at all. 2. Write this way in "Test2.cpp" :
#include "test2.h"
extern "C" {
#include "../test1/test1.h"
}3. Remember to add (to import, not file copy) "C:\Tmp\Test1\test1.c" and "C:\Tmp\Test1\test1.h" into your "test2" project. And everything compiles happily!
Maxwell Chen
-
I just created two project: 1. C:\Tmp\Test1, in C, 2. C:\Tmp\Test2, in C++. Test2 uses Test1 functions. Steps: 1. Compile Test1 without worrying about Test2 at all. 2. Write this way in "Test2.cpp" :
#include "test2.h"
extern "C" {
#include "../test1/test1.h"
}3. Remember to add (to import, not file copy) "C:\Tmp\Test1\test1.c" and "C:\Tmp\Test1\test1.h" into your "test2" project. And everything compiles happily!
Maxwell Chen
Thanks Its working fine.!!!!
Manish Patel. B.E. - Information Technology.
-
Thanks Its working fine.!!!!
Manish Patel. B.E. - Information Technology.
:)
Maxwell Chen