Solved

How to make Win32 Api calls from C++ Builder

Posted on 2003-11-15
4
1,968 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_
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
maze travler 6 55
C language IDE – Compilers installation 14 71
I could not build boost code, 10 88
Microsoft C++ code failing in executable that worked 9 98
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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

778 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