Solved

How to make Win32 Api calls from C++ Builder

Posted on 2003-11-15
4
1,912 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
4 Comments
 
LVL 16

Expert Comment

by:_nn_
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now