With the help of SO community I was successful to run my first MySQL based file in C++. Now y next step is to run on Apache as a CGI file. On Apache it's giving 500 Internal Server Error and in server Log I got the following:
Sat Jan 19 12:18:18 2013] [notice] caught SIGTERM, shutting down
[Sat Jan 19 12:18:23 2013] [notice] Digest: generating secret for digest authentication ...
[Sat Jan 19 12:18:23 2013] [notice] Digest: done
[Sat Jan 19 12:18:23 2013] [notice] Apache/2.0.63 (Unix) PHP/5.3.2 DAV/2 configured -- resuming normal operations
[Sat Jan 19 12:18:51 2013] [error] [client 127.0.0.1] Premature end of script headers: addproduct.cgi
I performed following steps
1- I went in DEBUG folder generated by netbeans and rename addproduct.o file to addproduct.cgi
2- Copied it in htdocs/myappfolder/
My file is using libs of MySQL and Boost and I guess I am getting error due to same reason. I am willing to know how do I link includes and libs along with CGI?
The C++ code is given below which comes along with MySQL Connector/C++
Update: After fiddling with paths I now get the following error:
inventory dyld: Library not loaded: libmysqlcppconn.6.dylib
Referenced from: /Applications/MAMP/htdocs/inventory/Inventory/dist/Debug/GNU-MacOSX/./inventory Reason: image not found Trace/BPT trap http://pastie.org/5723836
otool gives the following info:
otool -LMV inventory
inventory:
libmysqlcppconn.6.dylib (compatibility version 6.0.0, current version 6.1.1)
time stamp 2 Thu Jan 1 05:00:02 1970
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
time stamp 2 Thu Jan 1 05:00:02 1970
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)