Why would the file run with no problems when using Eclipse but when I create a jar file of the same program I can't run it locally on my pc?
This is the error I get where a is an input and signal.pl is a file I pass located in Desktop:
C:\Users\HP\Desktop>java -jar ADE2.jar a signal.pl
Exception in thread "main" org.jpl7.PrologException: PrologException: error(existence_error(source_sink, a), _0)
at org.jpl7.Query.fetchNextSolution(Query.java:438)
at org.jpl7.Query.hasMoreSolutions(Query.java:342)
at org.jpl7.Query.oneSolution(Query.java:872)
at org.jpl7.Query.hasSolution(Query.java:950)
at ADE.executeGorgias(ADE.java:19)
at ADE.main(ADE.java:41)
I assume that you have two different working directories in your two scenaries.
SWI-Prolog provides the working_directory/2 predicate in the form of working_directory(-Old, +New).
As the documentation states:
Unify Old with an absolute path to the current working directory and change working directory to New. Use the pattern working_directory(CWD, CWD) to get the current directory.
Thus, I would suggest to test working_directory(CWD, CWD) in both cases to see if your working directory differs, which may lead to probelms when working with relative paths.
Edit: You can also use absolute_file_name/3 to ensure that your "Eclipse use case" and your "jar use case" resolve the file in the same way.
Related
I'm trying to configure a debugger for my project.
Here is the problem.
The project folder structure can be simplified like this:
- Project Root
- X
- Y
- etc
I absolutely need to set the cwd in the debugger config as X, otherwise the binary won't run. If I set it as X, program runs, debugger (sort of) works: I see the call stack and the values of the variables. However, vscode cannot find the files with code and I can't see the lines being executed. VSCode also gives me an error:
Unable to open 'file.cpp':
Unable to read file '/blahblah/cwd/Y/file.cpp'
Error: unable to resolve non-existing file.
So the debugger rightfully uses the cwd as a prefix to the rest of the file path, but Y is not nested into X, it is actually in the same root directory.
Again, I absolutely need the binary to be called from the X directory. Is there any way to tell vscode the proper path to the code files in this case?
So here is what worked for me:
// added this to launch.json
"sourceFileMap: {
"proc/self/cwd" : "{workspaceFolder}"
}
From the VSCode docs:
sourceFileMap:
This allows mapping of the compile-time paths for source
to local source locations. It is an object of key/value pairs and will
resolve the first string-matched path. (example: "sourceFileMap": {
"/mnt/c": "c:\" } will map any path returned by the debugger that
begins with /mnt/c and convert it to c:\. You can have multiple
mappings in the object but they will be handled in the order
provided.)
My problem was that the directory from which I needed the process to run didn't match the directory where the source files are located. In the error message vscode gave me I saw the path it uses to try to find source files ("/proc/self/cwd"). So I mapped this path to the one I actually need (just the workspaceFolder in my case).
I am using an API called Piepan, which allows me to write Lua scripts for Mumble bots. For context, it is written in Golang using an alternative mumble implementation called Gumble. Piepan scripts are executed via cmd prompt through a piepan.exe.
I can require most libraries, like inspect.lua, and I can easily require luasocket in non-piepan scripts (scripts executed via lua.exe), but if I try to require luasocket (or what I really want, a redis library that depends on luasocket), I get an error. This is less of an error and more of a missing feature from the API, which the creator acknowledges. The creator suggests to someone else with this problem that they simply use Gumble, but I cannot do that as I am only a Lua programmer.
Here's the code of me just trying to require luasocket:
local socket = require ("include-test.socket")
(I've also tried include-test.socket.core and just socket.core)
In accordance with this stackoverflow answer, I moved my files to resemble the user's own directory, so it looks like this:
Piepan folder
-piepan exe and dlls (not luasocket dlls)
-include-test (folder)
--Script for piepan
--socket.lua
--socket folder
---core.dll
Despite the directory looking how I imagine it should based on other users' Q/As, I get this error:
.\include-test\socket.lua:13: module socket.core not found:
no field package.preload['socket.core']
Lstat : The system cannot find the path specified.
GetFileAttributesEx .\socket\core.lua: The system cannot find the path specified.
GetFileAttributesEx C:\Users\Michael\piepan\lua\socket\core.lua: The system cannot find the path specified.
GetFileAttributesEx C:\Users\Michael\piepan\lua\socket\core\init.lua: The system cannot find the path specified.
GetFileAttributesEx C:\Program Files (x86)\Lua\5.1\lua\socket\core.luac: The system cannot find the path specified.,
I've also tried including the following line, inspired by this stackoverflow answer.
package.cpath = package.cpath .. ';include-test/?.dll'
to no avail.
I am looking for any available solution, whether that be moving around dlls or compiling the original Piepan w/ extra files as needed.
(To clarify, I need a workaround that allows me to require the redis library within the same script I run through piepan. Using an outside script with the redis library to then, say, launch piepan and do something there, is not helpful to me.)
I am trying to port a new module into my project. The module has its own make file. I have no background or experience with the make build system, so I decided to use the following command:
make -f Makefile -f ../newmodule/tbt/makefile
But I get the following errors:
../newmodule/tbt/makefile:14: make/macros.mk: No such file or
directory
../newmodule/tbt/makefile:66: *** target file `all' has both : and :: entries. Stop.
Please correct me if I am wrong; it is my understanding that my first error is because I issued make from my main project, and I need to somehow configure it to look into the directory of ../newmodule/tbt/make to find macros.mk. Would anyone be able to suggest an effective way of addressing this issue? What is the best way to include the contents of ../newmodule/tbt/make folder?
My 2nd error seems to be exactly what make complains about, which is having : and :: in the two make files for the target "all". I can not follow the 2nd make file very closely, but there is not much to the lines that have this target. I am thinking of changing it to My_all, and configure this new variable as the default target of the new module. I am not even sure if my terminology is correct. "all" is called the default target for make right? I have reviewed most of the make file document, but it is 5 am, and I do not recall some things.
I came across this error during compilation of some package under OpenWrt. The problem was in the VERSION declaration in the Makefile.
So, check if you have declared anything with unnecessary spaces or comments after some variable.
Removing the comment or space after variables should work.
Try running two separate make -f myMakefile commands, one from each module directory so that the relative paths work out properly as you have already observed that you current directory when executing make may be part of the problem.
Original design :
Setting in property :
When the program is running :
All the image inside the project folder "QuickRecorder/Images/MainWindow".
How to solve this problem?
Thank you for your help.
In cases like this the reason almost always is: You use relative path to the image, and the working directory is different when you run the application, and image is not found by the relative path.
To debug, add this to your main to print current working directory:
qDebug() << QDir::currentPath();
A few solutions:
Use absolute paths (preferably so that you construct them at runtime, for example using QCoreApplication::applicationDirPath(), instead of hard-coding).
Put images to Qt resources, so they are embedded to the executable.
Change working directory after application starts (might have unintended consequences if you for example launch child processes, or with file open/save dialogs).
Untested, moved from comment to answer: To automatically copy files from the source dir to the build dir, you could add a build step "Custom Process Step" in the Qt Creator project settings. The command you might want to use for the case of this question might be (again, untested):
cp -rv %{sourceDir}/QuickRecorder %{buildDir}
After wasting some time to figure out what goes wrong, I finally have to ask for help. I want to use appledocs from Gentle Bytes. I followed every step of the quick install guide, but I´m not able to compile the project.
Here is what I´ve done:
1. cloned it from git://github.com/tomaz/appledoc.git
2. installed the templates to ~/Library/Application Support/appledoc
3. tried to compile the project
Everytime I try to compile, I get following error:
ERROR: AppledocException: At least one directory or file name path is required, use 'appledoc --help'
What do I have to do now?
Sounds like you've compiled it just fine and are now running the program. If it's a command-line program try command-option-R in Xcode to provide some arguments (i.e. names of files that you want to process).
The error means you didn't give it source paths: after all switches, you must give it at least one path to your source files. Can be either file or directory. In later case it will recursively scan the dir. Here's example
appledoc <options> ~/MyProject
Above example will use ~/MyProject directory as a source. You can also add multiple source paths. Note that you need to give the tool few options, see this page for minimum command line and other usage examples.
You either have to copy appledoc executable to one of directories in your path, as suggested by Caleb, or use full path to it when invoking (for example: /path/to/appledoc)