I'm trying to compile the following program and I get the corresponding output. I tried adding using namespace sword; but that did not help. I was able to compile the examples using the makefile generated from ./autogen.sh and /usrinst.sh, but what must I do to get this program to work? What must my makefile look like? Can I use bakefile? I'd really like it working soon as I am integrating the SWORD modules with Aletheia (
<a href="http://aletheia.sourceforge.net">aletheia.sourceforge.net</a>).<br><br>chad@chadjohnson:/tmp/sword/examples/cmdline$ g++ -L/usr/lib -I/usr/include:/usr/include/sword ciphercng.cpp <br>ciphercng.cpp:10:19: error:
swmgr.h: No such file or directory<br>ciphercng.cpp: In function 'int main(int, char**)':<br>ciphercng.cpp:22: error: 'sword' has not been declared<br>ciphercng.cpp:22: error: expected `;' before 'manager'<br>ciphercng.cpp
:23: error: 'ModMap' has not been declared<br>ciphercng.cpp:23: error: expected `;' before 'it'<br>ciphercng.cpp:24: error: 'it' was not declared in this scope<br>ciphercng.cpp:24: error: 'manager' was not declared in this scope
<br>ciphercng.cpp:31: error: 'SWModule' was not declared in this scope<br>ciphercng.cpp:31: error: 'module' was not declared in this scope<br><br><br><br><br>/******************************************************************************
<br> *<br> * This example demonstrates how to change the cipher key of a module<br> * The change is only in effect for this run. This DOES NOT change the<br> * cipherkey in the module's .conf file.<br> *<br> */
<br><br>#include <stdio.h><br>#include <swmgr.h><br>#include <iostream><br><br>using namespace std;<br><br>int main(int argc, char **argv) {<br><br> if (argc != 2) {<br> fprintf(stderr, "usage: %s <modName>\n", *argv);
<br> exit(-1);<br> }<br><br> sword::SWMgr manager; // create a default manager that looks in the current directory for mods.conf<br> ModMap::iterator it;<br> it = manager.Modules.find(argv[1]);<br>
<br> if (it == manager.Modules.end()) {<br> fprintf(stderr, "%s: couldn't find module: %s\n", *argv, argv[1]);<br> exit(-1);<br> }<br><br> SWModule *module = (*it).second;<br> string key;
<br><br> cout << "\nPress [CTRL-C] to end\n\n";<br> while (true) {<br> cout << "\nModule text:\n";<br> module->setKey("1jn 1:9");<br> cout << "[ " << module->KeyText() << " ]\n";
<br> cout << (const char *)*module;<br> cout << "\n\nEnter new cipher key: ";<br> cin >> key;<br> cout << "\nSetting key to: " << key;<br>
manager.setCipherKey(argv[1], (unsigned char *)key.c_str());<br> }<br><br><br>}<br>