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. simple question

simple question

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++data-structureshelp
4 Posts 2 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.
  • R Offline
    R Offline
    rbc
    wrote on last edited by
    #1

    I have this dll with a routine in it that I what to call. Lets call it comp1. So ... I create a project and add a C++ file to it that looks like this I change my prject setting so that comp1.lib is in that setting window. #include #include "comp1.h" void main( int argc, char * argv[] ) { char array[19]; comp1( "blah", "blah1", "blah3", array ); } I compile ok but when I link I get this error LNK2001: unresolved exteranl symbol "int __cdecl comp1( char *, char*, char*, char *const)" (?comp1@@YAHOOSOMETHING@Z) What am i doing wrong?

    J 1 Reply Last reply
    0
    • R rbc

      I have this dll with a routine in it that I what to call. Lets call it comp1. So ... I create a project and add a C++ file to it that looks like this I change my prject setting so that comp1.lib is in that setting window. #include #include "comp1.h" void main( int argc, char * argv[] ) { char array[19]; comp1( "blah", "blah1", "blah3", array ); } I compile ok but when I link I get this error LNK2001: unresolved exteranl symbol "int __cdecl comp1( char *, char*, char*, char *const)" (?comp1@@YAHOOSOMETHING@Z) What am i doing wrong?

      J Offline
      J Offline
      Jack Handy
      wrote on last edited by
      #2

      Try using: #pragma comment(lib, "comp1.lib") See if that works. -Jack To an optimist the glass is half full. To a pessimist the glass is half empty. To a programmer the glass is twice as big as it needs to be.

      R 2 Replies Last reply
      0
      • J Jack Handy

        Try using: #pragma comment(lib, "comp1.lib") See if that works. -Jack To an optimist the glass is half full. To a pessimist the glass is half empty. To a programmer the glass is twice as big as it needs to be.

        R Offline
        R Offline
        rbc
        wrote on last edited by
        #3

        #pragma works It tells me it cannot open comp1.lib :confused: I have copied comp1.lib to every directory on my hard drive! How can I get pragma to tell why it cannot open comp1.lib? Thanks!

        1 Reply Last reply
        0
        • J Jack Handy

          Try using: #pragma comment(lib, "comp1.lib") See if that works. -Jack To an optimist the glass is half full. To a pessimist the glass is half empty. To a programmer the glass is twice as big as it needs to be.

          R Offline
          R Offline
          rbc
          wrote on last edited by
          #4

          oops correction ... compl.lib was not in te right directory. I have copied it to the right place now and pragma lib doesn't say anything now. and I am now doing a the extern "C" { ... } ... bit and now I get LNK1106: invalid file or disk full: cannot seek 0xa3298473298 AAARRRRRRGGGGGHHHHH!!!!! help!

          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