Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Regarding integration of two different projects

Regarding integration of two different projects

Scheduled Pinned Locked Moved C / C++ / MFC
helpcsharpasp-netvisual-studioquestion
10 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    H4u32
    wrote on last edited by
    #1

    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

    M 1 Reply Last reply
    0
    • H H4u32

      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

      M Offline
      M Offline
      Maxwell Chen
      wrote on last edited by
      #2

      C++ projects can invoke C export functions, whereas C projects can not use C++ export functions and classes.

      Maxwell Chen

      H 1 Reply Last reply
      0
      • M Maxwell Chen

        C++ projects can invoke C export functions, whereas C projects can not use C++ export functions and classes.

        Maxwell Chen

        H Offline
        H Offline
        H4u32
        wrote on last edited by
        #3

        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

        M 1 Reply Last reply
        0
        • H H4u32

          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

          M Offline
          M Offline
          Maxwell Chen
          wrote on last edited by
          #4

          What are the error messages?

          Maxwell Chen

          H 1 Reply Last reply
          0
          • M Maxwell Chen

            What are the error messages?

            Maxwell Chen

            H Offline
            H Offline
            H4u32
            wrote on last edited by
            #5

            error LNK2019: unresolved external symbol "struct x264_t * __cdecl x264_encoder_open(struct x264_param_t *)

            M 1 Reply Last reply
            0
            • H H4u32

              error LNK2019: unresolved external symbol "struct x264_t * __cdecl x264_encoder_open(struct x264_param_t *)

              M Offline
              M Offline
              Maxwell Chen
              wrote on last edited by
              #6

              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

              M 1 Reply Last reply
              0
              • M 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

                M Offline
                M Offline
                manish patel
                wrote on last edited by
                #7

                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.h class 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.

                M 1 Reply Last reply
                0
                • M manish patel

                  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.h class 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.

                  M Offline
                  M Offline
                  Maxwell Chen
                  wrote on last edited by
                  #8

                  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

                  M 1 Reply Last reply
                  0
                  • M 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

                    M Offline
                    M Offline
                    manish patel
                    wrote on last edited by
                    #9

                    Thanks Its working fine.!!!!

                    Manish Patel. B.E. - Information Technology.

                    M 1 Reply Last reply
                    0
                    • M manish patel

                      Thanks Its working fine.!!!!

                      Manish Patel. B.E. - Information Technology.

                      M Offline
                      M Offline
                      Maxwell Chen
                      wrote on last edited by
                      #10

                      :)

                      Maxwell Chen

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups