NO

Author Topic: How do I get the IDE to link to a library I created from the command line?  (Read 2688 times)

PabloMack

  • Guest
I just started using ver 9. I like to create and manage modules and libraries using the command line tools but I want to link applicatoins that I build using the IDE. So I have two questions:

1. How do I include header files I create and exist in another directory without having to give the explicit paths?
2. How do I get the IDE to link to libraries I create and exist in another directory?

The INCLUDE environment variable conflicts with the system variable created for WATCOM but I created a user
variable with the same name and the IDE doesn't seem to find it. So I am using explicit paths. Also, I find no way
to tell the IDE how to link with a library I created. Please help.

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
use relative paths in both cases.
poide/pomake create INCLUDE variable from project settings, so it overwrites the old one.
pomake have an option /E to avoid that.
May the source be with you

PabloMack

  • Guest
I did that and it is working. Thank you.

kernel-of-truth

  • Guest
To clarify,

>>PabloMack: ...I like to create and manage modules and libraries using the command line tools

That is, using only the command line, you've created modules / libraries.

>>PabloMack: but I want to link applicatoins that I build using the IDE.

However, there are projects you're working on within the Pelles C IDE that need access to the libraries you created prior ( via the command line ).

>>PabloMack: 1. How do I include header files I create and exist in another directory without having to give the explicit paths?

It appears the Pelles C IDE requires the full path to .h, .lib and .exe files.

Setting Tools Options...

From within the v9 Pelles C IDE, navigate to Tools menu > Options... sub menu > Folders tab

Located at top-left of Folders tab page, you will see a Type: combobox.

Click on combobox and select Includes

Click on the New Folder icon immediately to the right of the combobox

Navigate to the folder you'd like to add to the project.

Repeat this for all #include paths.

Once you've added the desired #include paths, click on the Type: combobox and select Libraries

Same actions, navigate to the .LIB folder you'd like to add to the project.

>>PabloMack: 2. How do I get the IDE to link to libraries I create and exist in another directory?

If the above action does not resolve the .LIB issue, I would add the .LIB filename(s) to Project Options,

Setting Project Options...

With the project open ( the project you'd like to add the .LIB files to ), navigate to Project menu > Project Options... sub menu > Linker tab

Within Libary and object files textbox add, [SPACE]<you-libary-filename-here>

TIP: I always put my additions in uppercase so that I know which files I've added.

EXAMPLE

The default string for Libary and object files forPelles out of the box is,

   kernel32.lib user32.lib gdi32.lib comctl32.lib comdlg32.lib advapi32.lib delayimp64.lib

If I'm building COM components, my code needs access to UUID.LIB and OLE32.LIB.

The Libary and object files string for my COM components project looks like,

   kernel32.lib user32.lib gdi32.lib comctl32.lib comdlg32.lib advapi32.lib delayimp64.lib UUID.LIB OLE32.LIB

Hope this moves you closer to your goal.

kot

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Normally an additional include/lib paths belong to project.
Under Tools -> Options... -> Folders are paths for new projects and can be even empty.

pomake/poide use relative paths internally when possible, even the folder browsing show full paths.

Inside a C source file is possible to add other libraries with #pragma, for example #pragma comment(lib, "msvcrt.lib") (library for system msvcrt.dll).

It is also possible to use PrjOptions Add-In to check or modify project settings.
« Last Edit: March 16, 2019, 09:38:37 AM by TimoVJL »
May the source be with you

kernel-of-truth

  • Guest
Normally an additional include/lib paths belong to project.
Under Tools -> Options... -> Folders are paths for new projects and can be even empty.

Am I to understand that the Pelles IDE uses what's in Tools > Options... > Folders when it creates a new project only?

      That is, if new include or lib path info is added to Tools > Options... > Folders after a project has been created it will have no effect on the contents of INCLUDE and LIB interal to Pelles IDE?

pomake/poide use relative paths internally when possible, even the folder browsing show full paths.

Am I to understand that within the IDE, when a project is created or opened Pelles behind the scenes manages the fully-qualified path to the project folder, and presents it as, POC_PROJECT_WORKPATH=. to the IDE environment and POMake?

If the above conclusion is correct, and I've navigated to C:\dev\win\com_03 to open what will become  Project-01, the Pelles IDE has had an "opportunity" to learn the path location.

If I have a separate INCLUDE to add to Project-01, and it's location is R:\dev\2016\win\com_01\include I don't understand how Pelles IDE is using relative path information to know the 2nd INCLUDE's location. Again I'm talking from a the programmer's perspective of using the IDE not a Command-Line Prompt environment.

Although, even in a Command-Line Prompt environment, wouldn't I still need to have the following,

   SET PELL_HOME=C:\Program Files\PellesC
   SET INCLUDE=%PELL_HOME%\Include\Win;%PELL_HOME%\Include;R:\dev\2016\win\com_01\include
   SET LIB=%PELL_HOME%\Lib\Win64;%PELL_HOME%\Lib


Thanks in advance
kot

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
If PellesCDir environment variable is available , it could used.

I don't understand how Pelles IDE is using relative path information to know the 2nd INCLUDE's location.
of course relative paths are used only when the drive is same as where the project is located.
May the source be with you