Linker error with mysql.h in c programming - mysql

Hi I would like to solve how I can fix with linker error.
What I wanted to do is to include header file which is mysql.h from /usr/local/include.(I'm using mac book)
But when compiling the header file which is below, compiler says "Undefined symbols for architecture"
#include </usr/local/include/mysql.h>
I obviously installed mysql and connecter-c.
Please teach me how to fix it and why mysql.h is not included.
Best regards,

please check the format in which you have included the header file.
#include </usr/local/include/mysql.h>
should be
#include "/usr/local/include/mysql.h"
the "<>" is used to include system header files. please use double quotes ("") to include user header files.

Related

ExtensionMacros.h: No such file or directory

Although this file exists in the extensions folder but still i get this error. I have followed many solution but struck on this error. please help me.
In my extensions/Android.mk file I have also included
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/..
because ExtensionMacros.h is in the path $(LOCAL_PATH)
i suggest you add "LOCAL_EXPORT_C_INCLUDES += $(LOCAL_PATH)"
or change to #include "extensions/ExtensionMacros.h"

Linking issue CUDA 5.5 nsight

I am trying to compile a CUDA 5.5 application on nsight with ubuntu 12.04
At first I was getting an issue about missing header files such as #include <helper_cuda_drvapi.h>
To fix this I added the path /usr/include/samples/common/inc to my includes list.
This solved the missing header file issue but caused a new issue.
when trying to compile the program on nsight I get the following errors
/usr/local/cuda-5.5/samples/common/inc/helper_cuda_drvapi.h:278: undefined reference to cuInit'
/usr/local/cuda-5.5/samples/common/inc/helper_cuda_drvapi.h:279: undefined reference tocuDeviceGetCount'
/usr/local/cuda-5.5/samples/common/inc/helper_cuda_drvapi.h:290: undefined reference to cuDeviceGetName'
/usr/local/cuda-5.5/samples/common/inc/helper_cuda_drvapi.h:291: undefined reference tocuDeviceComputeCapability'
/usr/local/cuda-5.5/samples/common/inc/helper_cuda_drvapi.h:294: undefined reference to cuDeviceGetAttribute'
/usr/local/cuda-5.5/samples/common/inc/helper_cuda_drvapi.h:327: undefined reference tocuDeviceGetAttribute'
/usr/local/cuda-5.5/samples/common/inc/helper_cuda_drvapi.h:330: undefined reference to cuDeviceGetAttribute'
/usr/local/cuda-5.5/samples/common/inc/helper_cuda_drvapi.h:333: undefined reference tocuDeviceComputeCapability'
/usr/local/cuda-5.5/samples/common/inc/helper_cuda_drvapi.h:336: undefined reference to `cuDeviceGetAttribute'
any suggestions?
Thanks in advance
*****************UPDATE************
What it basically comes down to is I am trying to compile the "CUDA Video Decoder GL API" sample program on linux and it is not working because of some error with the header files. Does anyone know why this is?
UPDATE
The undefined references are to CUDA driver API methods. helper_cuda_drvapi.h has the following comment near the top:
Helper functions for CUDA Driver API error handling (make sure that CUDA_H is included in your projects)
So, in your .cu and .cpp files, before the #include <helper_cuda_drvapi.h>, include cuda.h:
#include "cuda.h"
#include <helper_cuda_drvapi.h>
See this question for more information about the CUDA headers.
You need to manually link with libcuda (Nsight projects use Runtime API)
To link with this library:
Go to Properties for your project, open General / Path and Symbols
On the Libraries tab add cuda (without prefix or suffix - in theory should make your project more clossplatform. You may also want to check "Add to all configurations" when adding the library - otherwise it will be for your current build configuration (e.g. "Debug" or "Release" only).
Update: Project settings screenshot:

Error: token "#" is not valid in preprocessor expressions

Can anyone tell me what would be the cause of the error
/mysql_com.h:306:5: error: token # is not valid in preprocessor expressions
while this mysql_com.h file does not contain any #. So how can I fix this error.
I think it's similar to the error when we open windows edited file in linux, then at that time ^V appers. But in this case # is not anywhere in the file.
Thanks in advance. Looking for your kind response.
Looks like this sort of problem has been reported when a '.h.in' file is included at some point, instead of the usual '.h' header file (eg. this) - perhaps because of some missing files or misconfigured include paths?
As has been previously suggested, I'd try tracing things back through the definition of MYSQL_VERSION_ID and double check that the correct .h files and include paths are present on your machine.
You have to check what is stored in MYSQL_VERSION_ID. Go to the library file, where this constant defined having the syntax like below :-
#define MYSQL_VERSION_ID BLAH-BLAH
Try to resolve this BLAH-BLAH, because this definitely have some problem, that have "#" symbol.

Including openFrameworks in MonoDevelop

How do I include openFrameworks in a MonoDevelop C/C++ Project?
I set the include path to the OF_ROOT/libs and can do #include <openFrameworks/ofMain.h> but I get an error that says the "ofConstants.h" file does not exist, but it does. It is somewhere in the OF_ROOT/libs/openFrameworks/ subdirectory.
ofMain.h includes the files like ofConstants.h like so #include "ofConstants.h"
Help! :)
It looks like openFrameworks has a strange setup for their headers, and needs include paths for all the subdirectories: https://github.com/openframeworks/openFrameworks/blob/master/apps/devApps/fboTester/emptyExample_linux.cbp#L47

'itkSingleValuedCostFunction.h': No such file or directory

I am trying to calculate the mutual information between two images, for that purpose I am using the class ‘MutualInformationImageToImageMetric’. After reading this example : http://www.itk.org/Wiki/ITK/Examples/Registration/MutualInformation I am using the following new four ‘#include’ lines in my code:
#include "itkImageRegistrationMethod.h"
#include "itkTranslationTransform.h"
#include "itkMutualInformationImageToImageMetric.h"
#include "itkLinearInterpolateImageFunction.h"
After that I received a fatal error telling me that : 'itkSingleValuedCostFunction.h': No such file or directory
I have use quite a lot of other classes of itk and it works always…what is happening now? Any hints please?
Thanks !
Antonio Gómez Barquero
I'm using the GIT version of ITK and updated my CMakeList.txt to
cmake_minimum_required(VERSION 2.8)
PROJECT(MutualInformation)
FIND_PACKAGE(ITK REQUIRED)
INCLUDE(${ITK_USE_FILE})
ADD_EXECUTABLE(MutualInformation MutualInformation.cxx)
TARGET_LINK_LIBRARIES(MutualInformation ${ITK_LIBRARIES})
Everything went fine.
Which ITK have you built?
I do not have ITK 3.20 built right now. Does itkSingleValuedCostFunction.h exist under Code\Numerics ? Is you makefile properly set to TARGET_LINK_LIBRARIES(MutualInformation ITKIO ITKNumerics) ?
Or, if you use ITK git, do you see the file under Modules\Numerics\Optimizers\include ?
Note that you could post questions related to ITK on the ITK mailing list. Register at http://www.itk.org/mailman/listinfo/insight-users