|
Re: MSVC 10 to Upp conversion [message #32695 is a reply to message #32689] |
Thu, 02 June 2011 11:12 |
nlneilson
Messages: 644 Registered: January 2010 Location: U.S. California. Mojave &...
|
Contributor |
|
|
Hi Koldo
It's good you got it to compile in MSC. I had links according to my setup.
Quote: | - About the library
In Build methods you say the compiler in which folders are the libraries, but in Package organizer you say the compiler which are the libraries to use.
|
I am a bit confused on this. In theIDE I did have to set the Build paths with Setup->Build methods for MSC9
and then do the same for MSC10. By "Package organizer" are you referring to the .upp file?
About the args the change from
int main(int argc, char *argv[]) {
to
GUI_APP_MAIN
{
was a bit of a change as I am not used to that.
The glitch I am having now is with no arguments.
How this app is set up to work is the dstile.exe or Guitiler.exe is placed in the FWTools bin directory.
Then the FWTools dos box is opened and then dstile.exe plus any options are typed on the command line.
If just dstile.exe with no args then just the 5 lines as from the code at lines #232 to #236 are printed:
"RUN: %s command ...\n"
" tile\n"
" overviews\n
" prep\n"
" pack\n"
The dstile.exe from your MSC compile should work that way.
My GUItiler.exe from the U++ compile does not.
even after setting argv[0] and argv[1] = "";
[Updated on: Thu, 02 June 2011 11:22] Report message to a moderator
|
|
|
|
Re: MSVC 10 to Upp conversion [message #32699 is a reply to message #32695] |
Thu, 02 June 2011 12:21 |
nlneilson
Messages: 644 Registered: January 2010 Location: U.S. California. Mojave &...
|
Contributor |
|
|
Hi Koldo
I will see what documentation and examples I can find on "CommandLine()"
Did you try your U++ compiled GUItiler.exe in FWTools without args and get the 5 lines printed?
I don't understand what you mean by this:
Quote: | More than that. It only links with MSC.
|
There a functions in the dstile code that relies on the FWTools code.
[Updated on: Thu, 02 June 2011 13:26] Report message to a moderator
|
|
|
|
|
|
|
|
Re: MSVC 10 to Upp conversion [message #32736 is a reply to message #32735] |
Sun, 05 June 2011 05:38 |
nlneilson
Messages: 644 Registered: January 2010 Location: U.S. California. Mojave &...
|
Contributor |
|
|
Compiled in debug mode I get an error that says in the MS error box:
Debug Assertion Failed!
Program: C:\FWTool~1.7\bin\ntile
File: f:dd\vctools\crt\self_x86\crt\src\close.c
Line: 47
Expression: (fh >=0&&(unsigned)fh <(unsigned)_nhandle)
I also tried this after copying HalifaxN.tif to the U++ output directory like I often do in Python for testing:
int main(int argc, char *argv[]) {
// --lztsd 10.0 --wwcache --overviews 0nt HalifaxN.tif
argc = 8;
argv[0] = "ntile";
argv[1] = "tile";
argv[2] = "--lztsd";
argv[3] = "10.0";
argv[4] = "--wwcache";
argv[5] = "--overviews";
argv[6] = "0nt";
argv[7] = "HalifaxN.tif";
I get the same error as above.
Another issue doing it this way or with the U++ "CommandLine()" is
this opens in a regular dos box rather than the FWTools dos box.
[Updated on: Sun, 05 June 2011 06:19] Report message to a moderator
|
|
|
|
|
Re: MSVC 10 to Upp conversion [message #32759 is a reply to message #32741] |
Mon, 06 June 2011 23:57 |
nlneilson
Messages: 644 Registered: January 2010 Location: U.S. California. Mojave &...
|
Contributor |
|
|
Hi Koldo
I am able to debug into the code now after hard coding the args and setting the environment with:
system ("C:/FWTools2.4.7/setfw.bat /K");
I have a U++ GUI I can later tie into this. (Honza helped with SelectDirectory()
Where I am getting the crash is at ~#164 Tiler.cpp
fl.Open(loc);
loc at that point is correct, a portion is "... _Ptr=2190390 "0nt/5/0442/0442_0351.jpg"..."
I don't know how or if that full line can be copied in U++.
With this placed just before the problem line
printf("%s", loc);
fl.Open(loc);
it prints <NULL>.
fl.open goes into syskit.cpp FileLock::Open where "fileName" parameter loc) is OK.
if (m_fd) close(m_fd);
is where it actually crashes.
If I comment that line out it seem to run OK for the base images.
When it gets to tiling the lower resolutions it crashes, probably just need to comment a line there also.
Is there something in U++ that is needed to lock/unlock?
[Updated on: Tue, 07 June 2011 01:23] Report message to a moderator
|
|
|
|
Re: MSVC 10 to Upp conversion [message #32763 is a reply to message #32759] |
Tue, 07 June 2011 07:45 |
nlneilson
Messages: 644 Registered: January 2010 Location: U.S. California. Mojave &...
|
Contributor |
|
|
In other IDEs a full line of text in the "Console" can be selected and copied. I don't know how that is done in U++.
So I just posted the pertinent part of that line.
I could upload the package but to run it needs a .tif file.
I will zip up the package and a small .tif (1.5MB) to test with.
The .tif files I usually work with are ~140MB.
It may take a few minutes to get that done and will edit this post with the link.
edit: Here is a .zip, it just replaces the previous:
http://www.nlneilson.com/apps/ntile.zip
In Debug->Options Working directory change that to where you place the .tif file.
In ntile.cpp #227 replace the location you have installed FWTools, the .bat file name should be the same and it needs the /K
In a few hours I will be heading up to my Ranch/Farm for a few days.
Apparently this cannot be debugged into the
FWTools/gdal code.
The MS crash box showed an error re assertion and close.
commented all the code that had "close" with small 'c'.
Runs OK with the overviews.
It does give a warning: Heap leaks detected !
Seems strange but if U++ can run it without problems it,s OK.
Now back to the GUI and tying that in.
One of the things I wanted to change in the original code was found and changed.
Thanks for the help Koldo.
[Updated on: Tue, 07 June 2011 08:30] Report message to a moderator
|
|
|
|
Re: MSVC 10 to Upp conversion [message #32785 is a reply to message #32773] |
Thu, 09 June 2011 10:38 |
nlneilson
Messages: 644 Registered: January 2010 Location: U.S. California. Mojave &...
|
Contributor |
|
|
Hi Koldo
We just got back tonight as something came up and had to get back early.
That is strange, I have not seen that error before.
I will look at that tomorrow.
Here is a .zip of ntile and also the GUI NLN_tile where ntile is included.
http://www.nlneilson.com/apps/01.zip
Here is how it is tied in:
void Work(){
FileOut out("nt.bat");
if(!out) {
Exclamation("Unable to open [* " + DeQtf(cfgfile));
Break();
}
out.PutLine("call cd C:\\0-Neil\\FAA\\2011\\Sectionals");
// out.PutLine("call ntile.exe tile --lztsd 10.0 --wwcache --overviews 0nt5 LA_clip.tif"); // 2
// out.PutLine("pause"); // 2
out.Close();
system ("nt.bat");
ntile(????????);
It took me a while to figure this out:
#include "ntile.cpp"
ntile.exe has been working OK and when nt.bat is made it works with the GUI, here I just hard coded the data in the nt.bat file, renamed main in ntile.cpp to ntile and commemted the argv hard coded in ntile.cpp and un commented this line:
out.PutLine("call ntile.exe tile --lztsd 10.0 --wwcache --overviews 0nt5 LA_clip.tif");
I have not figured out how to pass the argv from the GUI to the ntile function.
[Updated on: Thu, 09 June 2011 11:00] Report message to a moderator
|
|
|
Re: MSVC 10 to Upp conversion [message #32792 is a reply to message #32773] |
Thu, 09 June 2011 23:28 |
nlneilson
Messages: 644 Registered: January 2010 Location: U.S. California. Mojave &...
|
Contributor |
|
|
Hi Koldo
Quote: | ERROR 4: Unable to open EPSG support file gcs.csv.
|
It's not linked with FWTools\bin.
How the original dstile was used was dstile.exe was placed in FWTools\bin. Try placing the ntile.exe and the dstile.exe in the bin and you can try both.
Then right clicking on the FWTools icon then change Properties->Start in: to the directory the image files are in.
Then just open FWTools with a left click and enter the command line in the FWTools dos box that is opened:
dstile.exe tile --lztsd 10.0 --wwcache --overviews 0nt LA_clip.tif
Changing dstile.exe on the command line to the U++ compiled ntile.exe works the same way except it has the changes in the code.
To debug the code in U++ this was done:
In the FWTools Properties->Target: it has:
C:\WINDOWS\system32\cmd.exe /K "C:\FWTools2.4.7\setfw.bat"
This sets the environment.
So in the ntile code I added this so no changes to the FWTools properties need to be changed:
system ("C:/FWTools2.4.7/setfw.bat /K");
Then hard coded the args.
To run from the U++ GUI the hard coded args were commented.
Making the nl.bat to pass the args the line
out.PutLine("call cd C:\\0-Neil\\FAA\\2011\\Sectionals");
had to have the double \\ instead of the single \.
The problem of doing it that way is it is run by the .bat file using the ntile.exe that has been placed in FWTools\bin and there is no way to pass data back to the GUI.
And there is no way to debug the ntile code included with the GUI package because it is not used.
Maybe calling the ntile function included with the GUI code:
ntile("tile --lztsd 10.0 --wwcache --overviews 0nt LA_clip.tif");
is something I will try next.
Note that the ntile.exe placed in the FWTools\bin doesn't have any hard coded args, etc., just the code as compiled in MSVC 10 except when compiled in U++ some changes were made as far as the output format, etc..
Sorry my explanations and current code is lacking, still tinkering.
Your help with the linking, compiling in U++ is much appreciated.
[Updated on: Thu, 09 June 2011 23:34] Report message to a moderator
|
|
|
|
Re: MSVC 10 to Upp conversion [message #32794 is a reply to message #32793] |
Fri, 10 June 2011 03:36 |
nlneilson
Messages: 644 Registered: January 2010 Location: U.S. California. Mojave &...
|
Contributor |
|
|
Note that all the GUIs has a label FWTools and an edit field that shows "OK".
This is intended to check that ntile.exe is in FWTools\bin or if the FWTools\bin is linked correctly if the GUI is a stand alone .exe with the ntile included.
The previous GUIs had a wide box to show any errors in the dos box that was on top of only the GUI, maybe putting a pause at the end would keep the whole box visible on error.
[Updated on: Fri, 10 June 2011 07:46] Report message to a moderator
|
|
|