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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Eclipse C++ Project references

Eclipse C++ Project references

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++javacomquestion
5 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.
  • G Offline
    G Offline
    gvanto
    wrote on last edited by
    #1

    I was wondering if someone could help me out as a C++ newbie (also newbie in C++ in Eclipse) I'm from a Java background, and within eclipse (running on Kubuntu) when I set external Java projects as references to a project, I can simply do "import externalClass;" and voila, i can use that class in the current project ... This doesn't seem to be the case for C++ ... I've created a new project as a SharedLibrary -> Empty Project Then created my class, say MyClass in this project, say project A. (then built it) Now in project B (new project -> empty project but not shared lib) I want to use the class created in A (which i have set as a project reference in B) but #include MyClass.h throws an error. Am I missing something fundamental with how C++ shared libraries work? Help would be much appreciated, gvanto the noob

    Find Your Dream Job in Australia, Free! http://www.WebCV.com.au

    S CPalliniC 2 Replies Last reply
    0
    • G gvanto

      I was wondering if someone could help me out as a C++ newbie (also newbie in C++ in Eclipse) I'm from a Java background, and within eclipse (running on Kubuntu) when I set external Java projects as references to a project, I can simply do "import externalClass;" and voila, i can use that class in the current project ... This doesn't seem to be the case for C++ ... I've created a new project as a SharedLibrary -> Empty Project Then created my class, say MyClass in this project, say project A. (then built it) Now in project B (new project -> empty project but not shared lib) I want to use the class created in A (which i have set as a project reference in B) but #include MyClass.h throws an error. Am I missing something fundamental with how C++ shared libraries work? Help would be much appreciated, gvanto the noob

      Find Your Dream Job in Australia, Free! http://www.WebCV.com.au

      S Offline
      S Offline
      Stuart Dootson
      wrote on last edited by
      #2

      gvanto - it helps to tell us what error occurs (I presume it's a compiler error, that it can't see MyClass.h?) Anyway - building against a library in C/C++ requires that you specify two things - the source-code interface (that's MyClass.h in your case) and an object-code interface (hmmmm - Linux - that'll either be a .a or some shared thing - a .so file? - my only *nix experience is with OS X - which is probably close enough!). You also need to ensure that the directory in which these files live is specified. That means telling project B what directory contains project A's header file(s) and what directory contains project A's library file(s). The header file directory option will live with compiler options, while the library file directory option will live with linker options - I've never used Eclipse (with CDT?), so I can't be more exact than that. Anyway - give us a bit more detail and maybe we can sort you out!

      Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

      1 Reply Last reply
      0
      • G gvanto

        I was wondering if someone could help me out as a C++ newbie (also newbie in C++ in Eclipse) I'm from a Java background, and within eclipse (running on Kubuntu) when I set external Java projects as references to a project, I can simply do "import externalClass;" and voila, i can use that class in the current project ... This doesn't seem to be the case for C++ ... I've created a new project as a SharedLibrary -> Empty Project Then created my class, say MyClass in this project, say project A. (then built it) Now in project B (new project -> empty project but not shared lib) I want to use the class created in A (which i have set as a project reference in B) but #include MyClass.h throws an error. Am I missing something fundamental with how C++ shared libraries work? Help would be much appreciated, gvanto the noob

        Find Your Dream Job in Australia, Free! http://www.WebCV.com.au

        CPalliniC Offline
        CPalliniC Offline
        CPallini
        wrote on last edited by
        #3

        (I suppose you're using the g++ compiler) see [^]. :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [My articles]

        In testa che avete, signor di Ceprano?

        G 1 Reply Last reply
        0
        • CPalliniC CPallini

          (I suppose you're using the g++ compiler) see [^]. :)

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
          [My articles]

          G Offline
          G Offline
          gvanto
          wrote on last edited by
          #4

          Thanks for the link. Some useful fundamental stuff in there. But a tutorial on using shared C++ libs in eclipse, from start to end and cover things like: which header files to put where? - which project reference to select, which directory structure to use, etc would be good. (Just a simple example would be amazing) This one here comes close: http://janmagnet.wordpress.com/2007/09/30/eclipse-cdt-and-shared-libraries/[^] I followed that tutorial exactly and still I simply get a "make: *** [WLFeeder] Error 1, Type: C/C++ Problem " problem ... Double-clicking it doesn't do anything, no more info, thats it. If someone who knows how to use CDT in eclipse can make one project reference another (containing a class that needs to be used) it would be really really awesome. I'm left stumped. gvanto

          Find Your Dream Job in Australia, Free! http://www.WebCV.com.au

          modified on Thursday, February 12, 2009 6:55 PM

          G 1 Reply Last reply
          0
          • G gvanto

            Thanks for the link. Some useful fundamental stuff in there. But a tutorial on using shared C++ libs in eclipse, from start to end and cover things like: which header files to put where? - which project reference to select, which directory structure to use, etc would be good. (Just a simple example would be amazing) This one here comes close: http://janmagnet.wordpress.com/2007/09/30/eclipse-cdt-and-shared-libraries/[^] I followed that tutorial exactly and still I simply get a "make: *** [WLFeeder] Error 1, Type: C/C++ Problem " problem ... Double-clicking it doesn't do anything, no more info, thats it. If someone who knows how to use CDT in eclipse can make one project reference another (containing a class that needs to be used) it would be really really awesome. I'm left stumped. gvanto

            Find Your Dream Job in Australia, Free! http://www.WebCV.com.au

            modified on Thursday, February 12, 2009 6:55 PM

            G Offline
            G Offline
            gvanto
            wrote on last edited by
            #5

            ok found the problem: was using shared instead of static library! thanks guys for your help!! gvanto

            Find Your Dream Job in Australia, Free! http://www.WebCV.com.au

            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