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. Newbie struggling with makefile and linker

Newbie struggling with makefile and linker

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
4 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.
  • J Offline
    J Offline
    Janine
    wrote on last edited by
    #1

    Hello, I have a problem with makefile and linker. I get error LNK2001: unresolved external symbol "int __cdecl LibFunction(char *,int)" (?LibFunction@@YAHPADH@Z), when trying to use Function that is in mylib.lib. I have macros: LINK_FLAGS=/machine:I386 LIBS=..\lib\mylib.lib and I'm trying to link like this: myprogram.exe: $(OBJS) link $(LIBS) $(LINK_FLAGS) $(OBJS) /OUT:$@ How do I make the linker realize that LibFunction is in mylib.lib? Regards, -Janetta

    R 1 Reply Last reply
    0
    • J Janine

      Hello, I have a problem with makefile and linker. I get error LNK2001: unresolved external symbol "int __cdecl LibFunction(char *,int)" (?LibFunction@@YAHPADH@Z), when trying to use Function that is in mylib.lib. I have macros: LINK_FLAGS=/machine:I386 LIBS=..\lib\mylib.lib and I'm trying to link like this: myprogram.exe: $(OBJS) link $(LIBS) $(LINK_FLAGS) $(OBJS) /OUT:$@ How do I make the linker realize that LibFunction is in mylib.lib? Regards, -Janetta

      R Offline
      R Offline
      Rage
      wrote on last edited by
      #2

      Try to put your lib name and path into the Project/Settings/Link - Object/Library Modules editbox for all configurations that need it. ~RaGE();

      J 1 Reply Last reply
      0
      • R Rage

        Try to put your lib name and path into the Project/Settings/Link - Object/Library Modules editbox for all configurations that need it. ~RaGE();

        J Offline
        J Offline
        Janine
        wrote on last edited by
        #3

        There is only 'General' and 'Debug' tabs in the 'Settings' of this project. I guess it's because it is a makefile-project. If I'm wrong, please correct me. But aren't those tabs only a another way to tell the compiler and linker how to make the .exe. So what do I have to do my makefile instead of changing settings? PS. I would do the program withaut makefile if I could, but there is so much more in it. Btw, is there a way to combine a "normal" project and makefile? -Janetta

        B 1 Reply Last reply
        0
        • J Janine

          There is only 'General' and 'Debug' tabs in the 'Settings' of this project. I guess it's because it is a makefile-project. If I'm wrong, please correct me. But aren't those tabs only a another way to tell the compiler and linker how to make the .exe. So what do I have to do my makefile instead of changing settings? PS. I would do the program withaut makefile if I could, but there is so much more in it. Btw, is there a way to combine a "normal" project and makefile? -Janetta

          B Offline
          B Offline
          Bill Wilson
          wrote on last edited by
          #4

          Create a project with the settings you want to use. Then select Export Makefile from the Project menu. Merge/plagerize the result with your makefile project.

          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