Author Topic: Does Compiler plugin automatically add lib search path to PATH environment  (Read 5114 times)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5914
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
I use the wxWidgets wizard to create an app. The app is link to wx2.8 library build myself.
It was located in E:\code\cb\wx\wxWidgets-2.8.12.
When I click the "run" button, the app can run correctly.
But if I double click on the executable file in Windows Explorer, it will complain that the dll file wxmsw28u_gcc_custom.dll can't be found. (In-fact, the dll was located under "E:\code\cb\wx\wxWidgets-2.8.12\lib\gcc_dll", but this path is not in my Windows XP's PATH environment settings)

The question is:
At what stage C::B add the path "E:\code\cb\wx\wxWidgets-2.8.12\lib\gcc_dll" to the PATH environment, so I can directly run the app under C::B.

I looked at the wizard script, but I can't find anything related. The only thing I found is that "E:\code\cb\wx\wxWidgets-2.8.12\lib\gcc_dll" is the library search path. Does the Compiler plugin automatically add the library search path to the PATH environment?

I'm not quite familiar with Compiler plugin, the PATH handling looks quite complex.

Thanks.

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5914
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Looks like my guess is right, I just did some test, the Compiler plugin DO add the lib search path to the PATH environment.
So, what's reason? (Maybe, under Linux, the .so file can be linked at both compiler time or run time.........Ok, that's the same thing under Windows, I can link to a dll file, but normally I should link to .a files)

I'm currently design a wizard for OpenCV library, it has such file structure:
Code
<opencv root>
├─bin
├─include
│  └─opencv
├─lib
└─licenses

The bin folder contains all the dlls, the lib folder contains all the .a files. In this case, I would like the <opencv root>/bin folder automatically/temprarily added to the PATH when I click the "run" button. (This way, I don't need the manually add this bin path the System's PATH). But currently the only workaround is add the bin path to the library search path. ( $(#cv.bin) does not work, and $(#cv)/bin works)

Any good suggestions. Thanks.

EDIT: the workaround by adding the bin folder has a drawback, look at the log:
Quote
[ 50.0%] g++.exe -g -IE:\code\opencv\opencv210_mingw\include -c main.cpp -o obj\Debug\main.o
[100.0%] g++.exe -LE:\code\opencv\opencv210_mingw\lib -LE:\code\opencv\opencv210_mingw\bin -o bin\Debug\jjjjj.exe obj\Debug\main.o   -lcv210.dll -lcxcore210.dll -lhighgui210.dll
Output size is 99.56 KB
Process terminated with status 0 (0 minute(s), 1 second(s))
0 error(s), 0 warning(s) (0 minute(s), 1 second(s))
It looks like the link directly try to find the dll?

Look at the previous log:(no workaround)
Quote
[ 50.0%] g++.exe -g -IE:\code\opencv\opencv210_mingw\include -c main.cpp -o obj\Debug\main.o
[100.0%] g++.exe -LE:\code\opencv\opencv210_mingw\lib -o bin\Debug\jjjjj.exe obj\Debug\main.o   -lcv210.dll -lcxcore210.dll -lhighgui210.dll
Output size is 99.56 KB
Process terminated with status 0 (0 minute(s), 1 second(s))
0 error(s), 0 warning(s) (0 minute(s), 1 second(s))
This should definitely link to the .a files.

This is my lib settings(see the screen shot below)


« Last Edit: March 29, 2013, 04:54:31 am by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.