wt: Document root was not set, or was set to the empty path. - c++

I am new to wt(Web Toolkit/witty). When I try to execute hello-world example program source code , I got the following exception "Document root was not set, or was set to the empty path. Use --docroot to set the HTML root directory." I set the command arguments as "--http-address=0.0.0.0 --http-port=8080 --deploy-path=/hello --docroot=.". I capture argument values as "Arg C = 1 and Arg V = 0000023C3B649E30" Please help.

I'm not sure if you have got the solution. Just to help others.
here is the list of options which you need to give if you are tyring to run your wt web app from cli/terminal in linux.
./<your_web_app> --http-address=0.0.0.0 --http-port=8085 --deploy-path=/hello --docroot=.
now after go to your browser and open the new tab and give "http://localhost:8085/hello"
should give you your webpage which you are building

Below solution worked for me.
"If you are using Visual Studio you can add them by right clicking on your project, then going to Properties > Configuration Properties > Debugging > Command Arguments.
Open a web browser and go to http://localhost:8080/hello to test your application."
https://andres.jaimes.net/780/how-to-create-a-first-application-using-wt-witty/

Related

Wamp: The configuration file contains a syntax error on line 24

How can I start the wamp server on windows 7 using wamp version 2.4?
Following is the error message I get:
The configuration file contains a syntax error on line 24:
[EParseError][config] section directive "ImageList" already specified.
Error:
The configuration file contains a syntax error on line 7;
[EParseError] No tray icon was specified. Please assign a tray icon by
using on the of the Tray icon directives in the [Config] section.
Caused by:
Computer abruptly shutting down while server is running
Fix:
• Go to the wamp/scripts folder
• Open console/cmd as admin
• run: php refresh.php
• Done!
Make sure you have php in your system environment settings
then go to the wamp/scripts folder
open console
run:
php refresh.php
answer from here solved my issue, referenced above info from this stack answer
ISSUE
You have a duplicate entry on C:\wamp\wampmanager.ini
ImageList=images_off.bmp or something like that.
FIX
Remove one of them (probably line 24)
It sounds like you have been playing with \wamp\wampmanager.tpl
Never play with wampmanager.tpl unless you have taken a copy first!
WAMPServer rebuilds \wamp\wampmanager.ini using a script that uses \wamp\wampmanager.tpl among other files as input, each time you start WAMPServer or when you use the wampmanager menus and click refresh.
So to fix your problem edit of wampmanager.tpl to remove the duplicated line and then do:
rightclick wampmanager icon -> refresh
Or just exit wampmanager and restart it.
to rebuild the \wamp\wampmanager.ini file
Take a backup of your Wampmanager.ini file in your wamp installation directory (in my case it is c:\Wamp64). Then rename it or move it to some other folder.
Get the wampmanager.ini from a new installation or any similar installation if you already have, then paste it in the same path. It will work like charm. This may change any of the settings you had earlier but it will make your wamp working without reinstalling it.
Wamp Manager folder
Wamp Manager configuration file in CMD prompt
It is interesting that this error shows up after initial install of the current version 3.2.6 found on aviatechno (without being able to tamper with any installed configuration file, the .ini in the installation is broken). It reports an error with line 27: WAMPMARIADBOFF.
[Services]
Name: APACHESERVICE
WAMPMARIADBOFFName: MARIADBSERVICE
WAMPMYSQLOFFName: MYSQLSERVICE
Use the new ini repair tool you can find on the aviatechno website
which corrects the lines in the ini file as:
[Services]
Name: wampapache
Name: wampmysqld
Name: wampmariadb
...
Action: service; Service: wampapache; ServiceAction: startresume; Flags: ignoreerrors
Action: service; Service: wampmysqld; ServiceAction: startresume; Flags: ignoreerrors
Action: service; Service: wampmariadb; ServiceAction: startresume; Flags: ignoreerrors
Only do this on new installs
Even after that wampserver does not start or does not start the services. To repair: stop the background process AeTrayMenu, head over to the folder c:\wamp64 removing its content and reinstall.
This did the trick for me.

GDB on eclipse debug mode can't find stdlib/rand.c

I am trying to put the gdb to run with eclipse cdt on ubuntu to start debugging some simple programs. So I did the steps I reckon as necessary to get it running:
1. Create an executable project
2. Compile
3. Run
4. Create the file .gdbinit and place it on the main project folder
5. Set some of the debugger configuration:
5. I also tried to find a .gdbinit file that would look some like this:
set schedule-multiple
dir ~/gcc_build/4.7.2/build/gcc
dir ~/gcc_build/4.7.2/gcc
dir ~/gcc_build/4.7.2/gcc/cp
dir ~/gcc_build/4.7.2/gcc/lto
source ~/gcc_build/4.7.2/build/gcc/gdbinit.in
But I didn't find anything similar in my computer, even after doing a:
# find / -name .gdbinit
So, my file .gdbinit end up with the simple content - yes only that:
set new-console on
Then I clicked on Apply and Debug:
The gdb starts working nicely as expected. I press the button "step over / F6" and the debugger goes jumping through the code step by step. Until the point it reaches the command rand() and the gdb hangs with the message:
Can't find a source file at "/build/buildd/eglibc-2.19/stdlib/rand.c"
Locate the file or edit the source lookup path to include its location.
Thus I also tried unsuccessfully to find the rand.c to update this path to include its location:
# find / -name rand.c
# find / -name stdlib
After the error message from GDB complaining that rand.c is missing, then I tried to keep stepping... since then the stepping mode is disable when I restart the debug:
Is this problem happening because some setting for my file .gdbinit is missing? Or some how GDB is not able to find the rand.c from stdlib from c99? When I compile and run the program it runs nicely. Only when I try to launch the debugger is when GDB crashes.
Update: I got the missing rand.c problem after running the commands:
# apt-get install libc6-dbg
# apt-get source libc6
But now a different error appears:
Can't find a source file at "/build/buildd/eglibc-2.19/csu/libc-start.c"
Locate the file or edit the source lookup path to include its location.
Should I also install that library for gdb?
All suggestions are highly appreciated.
From what I saw on your description... looking to the 4th and 5th image you posted, you did right all the required steps.
However, it seems to me that your GDB is attached to several projects. That means that unless you really need that, I would strongly advise you to select all project that you are not currently debugging and delete them from the debugger mode. So, my suggestion is that after you have done all the steps you did so far, then go on:
Debug Configurations > C/C++ Applications: (drop down it)
... then click on each project you are not compiling, with right button from the mouse select "delete" - but don't worry, it will not delete your project, but only the attachment of that project to your debugger mode.
Then restart the eclipse. When you again try to run in the debugger mode, everything will run much smoother than before.
Step1:
Go to https://www.gnu.org/software/libc/ to download glibc.
Step2:
unzip it locally and whenever the eclipse prompts "Can't find ... xxx.c", just load the file into eclipse. It will work.

Installing MinGW's gdb.exe for Code Blocks

Hey guys I really need help.
I have recently started programming C++ again and I am trying to get Code Blocks up and running but it keeps failing because of this error.
"ERROR: You need to specify a debugger program in the debuggers's settings."
Understandably this means there isn't a debugger program so I have to download one. I tried to find the gdb.exe for MinGW but I can't find it at all. I just end up with the MinGW's Installation Manager and being left confused.
Are there any tutorials about using the MinGW written for beginners or anyone willing to help?
Thanks in advance.
Steps to add gdb.exe
Open MinGW Installation Manager
select package "mingw32-gdb" from the list.
Then select "Apply Changes" in Installation menu.
This will automatically install gdb.exe in the path C:\MinGW\bin.
Please let me suggest you debugger program TDM-GCC. For download and install visit
http://wiki.codeblocks.org/index.php?title=MinGW_installation
Because a debugger program (toolchain) is very complex undertaking, is not standard in Code::Blocks. You must download it and install on Code::Blocks.
Note: It is impossible copy and paste images here. In the case linked page changes, I, or another one, should suggest new link.
However following are instructions according to images and my experience.
Download TDM-GCC from https://jmeubank.github.io/tdm-gcc/download/ click [tdm64-gcc-10.3.0-2.exe] and run it.
In Wizard Action window - Click [Create].
In Select Edition window - If MinGW/TDM (32-bit) is not checked, check it. Click [Next>].
In Licence Changes window - Click [Next>].
In New Instalation: Instalation Directory window - If text box is "C:\TDM-GCC-32", it's okay. If is not, click [Browse ...], and navigate: C:\ > TDM-GCC-32 > click [OK]. Now text box is C:\TDM-GCC-32. Click [Next>].
If a small window appears saying The directory TDM-GCC-32 is not empty! Are you sure you want to install here?. Click [Yes].
In New Installation: Download Mirror window - Click [Next>].
In New Installation: Choose Components window - Check whether Add to PATH box is checked. Actually is checked. Click [Install].
In Installing window - Wait till [Next] become black. Then click it. Even if Instalation Failed window appears click [Next].
In Completing the TDM-GCC Setup Wizard window - Click [Finish].
Go to Code Blocks > Settings > Compiler.
10a. In Global compiler settings window click "Toolchain executables". Just below, find "Compiler's installation directory". If the below text field is C:\TDM-GCC-32, it's okay. If not, click the [...] at the end of the field. In "Select directory" wizard, navigate to C:\TDM-GCC-32. Now "Folder:" should be TDM-GCC-32. Click [Select a folder] in "Select directory" wizard.
10b. In Global compiler settings. Below red "Note:..." find "Program Files" > "Debuger". If text field reads "GDB/CDB debuger : Default", it's okay, click [OK]. If not, click the down arrow at the end of the field > choose "GDB/CDB debuger : Default". Check that text field is "GDB/CDB debuger : Default". Click [OK].
Go to Code Blocks > Settings > Debugger... . In Common window, left list, click "Default". If "Executable path:"'s text field is "C:\TDM-GCC-32\bin\gdb32.exe", it's okay, click [OK]. If not, click [...] button and navigate C: > TDM-GCC-32 > bin > click gdb32 (or gdb32.exe) file > click [open] in "Select executable file" wizard. "Executable path:" should be C:\TDM-GCC-32\bin\gdb32.exe. Click [OK]. Now you can debug your program.
If Debugger does not function, close Code Blocks and restart them.
Regards.
Hey guys I suggest a better way. Download "gdb.exe" from the Internet and copy it to the below path.
C:\MinGW\Bin
It's really works. I did it.

System Call C++ with Weka

I'm writing a C++ project that will occasionally use a system call to Weka to get some machine learning information. First I'd like to ensure that the training model (training.model) is up to date. So, at the beginning of main, I call:
system("\"java weka.classifiers.trees.J48 -t ML_data.arff -d training.model\"");
That gives Error: could not find or load main class weka.classifiers.trees.J48. I know what that means, so I moved the entire Weka project folder, entitled Weka-3-6, to the directory in which my project is found. So then I tried:
system("\"java \Weka-3-6\\weka.classifiers.trees.J48 -t ML_data.arff -d training.model\"");
But that returns Error: could not find or load Weka-3-6\weka.classifiers.trees.J48.
I feel like I'm in the right neighborhood, but I can't get the slashes right, and I'd prefer not to mess with absolute paths because the folders have spaces and that makes it even messier. Any ideas? Help is greatly appreciated.
Open a terminal/cmd prompt and try to run your command in your terminal/cmd prompt. Following is an example cmd batch script for windows. Your problem is most likely java classpath settings not weka problem. If you succeed in following command, then try your command with again in c++.
SET WEKA_HOME=C:\Program Files\Weka-3-7
SET CLASSPATH=%CLASPATH%;%WEKA_HOME%\weka.jar
SET HEAP_OPTION=-Xms4096m -Xmx8192m
SET JAVA_COMMAND=java %HEAP_OPTION%
%JAVA_COMMAND% weka.core.SystemInfo

Eclipse juno c++ debug error 193

This happened the first time I've tried debugging with Eclipse juno C++:
Error in final launch sequence
Failed to execute MI command:
-exec-run
Error message from debugger back end:
Error creating process <full path>... (error 193)
Running the program using "Run" instead of "Debug" works just fine but when I try debug I get this. I googled about a bit and found somewhere that I should remove any spaces from the directory; I did that but it still isn't working.
The version of eclipse I'm running is:
Eclipse IDE for C/C++ Developers
Version: Juno Service Release 1
Build id: 20120920-0800
Edit:
Problem is sorted! It was because I had forgot the space in my user account name. Because I couldn't be bothered to go through a load of mess changing the folder name in users I just moved my workspace folders straight to my C Drive so the path that it follows is now: C:\eclipse\WorkspaceC++
Thank you very much to john in the comments :)
From OP edit: Problem is sorted!
It was because I had forgot the space in my user account name.
Because I couldn't be bothered to go through a load of mess changing the folder name in users I just moved my workspace folders straight to my C Drive so the path that it follows is now: C:\eclipse\WorkspaceC++