Home » Community » Newbie corner » How to find the path for a Directory? - Windows (undefined reference to `_imp__PathAppendA@8')
How to find the path for a Directory? - Windows [message #43955] |
Thu, 27 November 2014 14:04 |
rfdiaz
Messages: 4 Registered: November 2014 Location: USA
|
Junior Member |
|
|
Hi,
I'm new to U++ trying to find "paths" under Windows.
This is my test code:
#include "stdio.h"
#include <windows.h>
#include <iostream>
#include "Shlwapi.h"
using namespace std;
int main(int argc, const char *argv[])
{
// String for path name.
char buffer_1[MAX_PATH] = "name_1\\name_2";
char *lpStr1;
lpStr1 = buffer_1;
// String of what is being added.
char buffer_2[ ] = "name_3";
char *lpStr2;
lpStr2 = buffer_2;
cout << "The original path string is " << lpStr1 << endl;
cout << "The part to append to end is " << lpStr2 << endl;
bool ret = PathAppend(lpStr1,lpStr2);
cout << "The appended path string is " << lpStr1 << endl;
return 0;
}
It gives the following error:
PathTest.cpp
PathTest: 1 file(s) built in (0:00.96), 967 msecs / file, duration = 983 msecs, parallelization 0%
Linking...
C:/upp/out/uppsrc/PathTest/MINGW.Debug.Debug_Full.Main.Sse2\ PathTest.o: In function `main':
C:/upp/uppsrc/PathTest/PathTest.cpp:21: undefined reference to `_imp__PathAppendA@8'
collect2.exe: error: ld returned 1 exit status
Maybe this is something obvious yet I have not been able to get it...
Searching on the subject I found a post at StackOverflow which suggests that
"You need to add the shlwapi library for linking:
gcc -o test test.c -lshlwapi"
Thanks for any Path to the solution!!!
Rfdiaz
|
|
|
Goto Forum:
Current Time: Sat Apr 27 17:05:50 CEST 2024
Total time taken to generate the page: 0.06037 seconds
|