Solved

How to make Win32 Api calls from C++ Builder

Posted on 2003-11-15
4
2,058 Views
Last Modified: 2012-08-14
Hello I am trying to call

PathRemoveFileSpec(FileName); //Shell api call from win32 library

but Borlands C++ builder gives me a linker error

[Linker Error] Unresolved external 'PathRemoveFileSpecA' referenced from C:\DOCUMENTS AND SETTINGS\MY DOCUMENTS\COLLEGE_WORK\YEAR4\SOFTWARE ENGINEERING\LAB2\MAIN.OBJ

I have tried including

#include "shlwapi.h"

and including the following directories
C:\Program Files\Microsoft SDK\include
C:\Program Files\Microsoft SDK\Lib

to Project->Options->Directories/Conditions libs and includes

But stil the same error any ideas?
0
Comment
Question by:auk_ie
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 16

Expert Comment

by:_nn_
ID: 9757194
Never used C++ Builder myself, but have you already tried to add explicitly shlwapi.lib to the list of objects to be linked ?
0
 
LVL 49

Assisted Solution

by:DanRollins
DanRollins earned 125 total points
ID: 9757857
I believe that even a free compiler such as that Borland thing supports the #pragma that will include the necessary lib file.  So try adding this at the top of your program:

   #pragma comment( lib, "SHLWAPI.LIB" );

if that doesn't work, try the full pathname:

     #pragma comment(lib, "C:\Program Files\Microsoft SDK\LibSHLWAPI.LIB" );

-- Dan
1
 
LVL 2

Accepted Solution

by:
xssass earned 125 total points
ID: 9957610
I used some winapi functions myself, and all I had to do is enter
"#include <windows.h>"
before "#pragma hdrstop"

Hope this helps,
  .K.
0
 
LVL 9

Expert Comment

by:tinchos
ID: 10249245
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: DanRollins {http:#9757857}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Tinchos
EE Cleanup Volunteer
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question