Build error when using Mac C++ to connect to sqlite3 - c++

I am attempting to learn how to connect to sqlite3 using C++ on a Mac Xcode compiler.
I have the following include files..
#include <iostream>
#include "sqlite3.h"
I have tried the two sqlite3 open functions…
sqlite3_open and sqlite3_open_v2
The Xcode tool finds no errors until I try to compile. Then I get a “Build Failed” error with no further explanation.
What is the likely cause and how can I track down the error?

The likely cause is your code is incorrect (eg. #include "sqlite3.h" should be #include <sqlite3.h>, etc). Without posting the exact error nobody here can tell you specifically why.
How to track down the error is pointed out in the documention:
Choose View > Navigators > Show Log Navigator to view the reports that
Xcode generates during your development process. Alternatively, you
can click the log navigator button
in the navigator selector bar of the workspace window.
↳ Finding and Fixing Issues from the Log Viewer

Related

Including <string> in c++ using Netbeans

Netbeans fails compilation on:
#include <string>
Output says:
main.c:10:18: fatal error: string: No such file or directory
#include <string>
The previous two declarations are included fine:
#include <stdio.h>
#include <stdlib.h>
I have removed all the code afterwards to make sure.
I am using cygwin_64 and it installed as per Netbeans c++ installation manual and shows versions in CLI
I am new to C++ and I know there have been similar questions, but the answers didn't help me.
Just try to create new project and follow these steps:
Click File->Create project.
Choose C/C++, then C/C++ application, click Next.
Enter project name and in the right choose C++ in combobox. Or C++11.

Link: fatal error LNK1561: entry point must be defined VS2015 developer cmd window

I have read a ton of this same question, but I appear to be doing everything correctly as all suggestions advise, but am still getting this error.
I have simple .cpp and .h files in C++ using Visual Studio 2015. My program runs perfect from the gui. I need to run it in the visual studio developer command window to get the results there, this is a verified console application. I have copied the files to their own directory using:
C:\RunDirectory>copy C:\SaveDirectory\
The system verifies that it copies all 15 files.
When I run this command:
C:\RunDirectory>cl Aprogram.cpp
Then I get the error.
I have a main that is returning an int, and this is a console application with the correct linker settings: Console (/SUBSYSTEM:CONSOLE)
Any ideas? I'm pretty stumped.
This is my driver file:
#include "stdafx.h"
#include <iostream>
#include <string>
#include <vector>
#include "JollyBanker.h"
using namespace std;
int main()
{
JollyBanker theBanker;
theBanker.BuildQueue("BankTransIn.txt");
theBanker.ProcessQueue();
theBanker.DisplayResults();
return 0;
}
File Aprogram.cpp is a source code file, which is compiled and linked
into an executable by Visual Studio IDE. Assuming that default project
settings are used, this executable is located in "Debug" or "Release"
subdirectory of the directory that contains your solution and it is named
ProjectName.exe (where "ProjectName" is the name of the project
within the solution that contains Aprogram.cpp)
Also, you mentioned that you want to make sure it works outside VS. Note
that if you have used the default settings, you will have problems when you
run this executable on another machine. To solve this, I suggest that you
change the runtime library that you are linking to. To do this, right click on
the project in Solution Explorer and select "Properties". Go to "C/C++" -> "Code Generation"
and change the value of "Runtime Library" to "Multi-threaded Debug (/MTd)" for "Debug" configuration, or to "Multi-threaded (/MT)" for "Release" configuration.

Simple C++ program using pqxx (postgres)

I'm trying a very basic C++ program using Code::Blocks. I'm on Ubuntu 12.04 and installed pqxx from the software manager. Here's the code.
#include <pqxx/pqxx>
#include <iostream>
using namespace std;
int main()
{
pqxx::connection MyConn ("dbname=dbESM user=postgres");
cout << "Hello world!" << endl;
return 0;
}
But I get the following error on hitting F9 to compile and run:
/usr/include/pqxx/connection.hxx|87|undefined reference to
`pqxx::connectionpolicy::connectionpolicy(std::basic_string, std::allocator > const&)'
The above message is from the file connection.hxx and the line highlighted is this:
explicit connect_direct(const PGSTD::string &opts) : connectionpolicy(opts) {}
The connection.hxx file is not mine - I think it's part of pqxx.
I'm pretty new to this platform so I'm avoiding the terminal to compile code. Any help would be greatly appreciated.
You need to add the reference to the libpqxx library to the project.
Inside Code::blocks, when the project is open, locate Project in the menus, then follow Build options, then open the tab called Linker settings, then hit Add, then enter pqxx.
If you were using the libpq C library instead, the procedure would be identical except the name would be pq.
You need to link against the according library, just #including the header files isn't enough. If available, you could use pkg-config to determine the according libraries. Further, what IDE are you using? Without that, the "on hitting F9" reference is useless. Also, compiling this on the commandline might even be easier, since it is clearer what exactly is happening.

unresolved inclusion error eclipse

So I went to this thing call the digital media academy for 3D game programming. We used eclipse along with Panda3D using their Macbook Pro's to create 3D games. I created an awesome game there which ran beautifully. However when I put everything on a USB and installed everything back on my personal macbook pro at home, I see question marks next to these lines of code that say Unresolved inclusion:
// Panda3D stuff.
#include "auto_bind.h"
#include "audioManager.h"
#include "executionEnvironment.h"
#include "filename.h"
//C++ stuff
#include <cmath>
#include <cstdlib>
#include <iostream>
In the problems section of eclipse I get this:
make: *** No rule to make target `all'. Stop.
I think, there are at least two issues here.:
Unresolved includes:
This can be a glitch with the indexer, a simple index rebuild or a recompile would help
Try Right click on project > Index > "Rebuild" or "Re-resolve Unresolved Includes"
If no luck then,it's not just a glich but a real problem, so check:
Project > Properties > C/C++ General > Path and Symbols > Includes
There you should have the directories where the C++ headers are and
the "Panda" headers should be with your source files.
Missing "all" target:
What CDT is trying to do is invoking make with a target called "all" which is missing
from your Makefile. Either CDT is configured for the wrong target and
the "all" is not what you need, or something is wrong with the "all" target.
You should provide us more information: the proper (original) Makefile
The settings here: Project > Properties > C/C++ Build > Behaviour > Make build target

Berkeley DB(Unable to Locate Component)

I have a problem with berkeley DB. I get a dialog titled "Unable To Locate Componenent" saying "This application has failed to start because libdb48.dll was not found. Re-installing the application may fix this problem", then it crashes after clicking ok. I got the error message when running these simple code below:
#include <iostream>
#include <string>
#include <db_cxx.h>
using namespace std;
int main()
{
Db db(0, 0);
}
I already set the Additional include directories to the "build_windows" directory and I have linked to the "libdb48.lib". I honestly do not know what to do here. The funny part is, I googled and I had 0 pages returned.
I am using visual studio c++ 2008 and Berkeley DB 4.8.24
Thanks
Where is libdb48.dll? Is it installed? Where? A hackish solution that should make it work is to copy libdb48.dll into c:\windows\system32. If that solves the problem, then you know that the DLL just wasn't on the path. Then you can find a more appropriate place to put it.