Linking issue CUDA 5.5 nsight - cuda

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:

Related

How to link cusparse using CMakeLists.txt

How can I add the cusparse library from CUDA in a CMakeLists.txt-file, such that the nvcc compiler includes it automatically with -lcusparse? I already added the line
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-lcusparse)
in CMakeLists.txt with no success. It looks like I'm missing something, because Nsight throws the error
undefined reference to 'cusparseDestroyMatDescr'.
Although when I exclude this line where cusparseDestroyMatDescr is called via commenting it, the Nsight project builds with no error, even with these three lines of code included
cusparseStatus_t status;
cusparseHandle_t handle=0;
cusparseMatDescr_t descr=0;
So it looks like it knows what cusparseStatus_t and so on is, but it does not know what cusparseDestroyMatDescr is.
What do I miss?
The correct way in CMake to link a library is using
target_link_libraries( target library ).
If you use FindCUDA to locate the CUDA installation, the variable CUDA_cusparse_LIBRARY will be defined. Thus, all you need to do is
target_link_libraries( target ${CUDA_cusparse_LIBRARY} )
I recommend to use the CMake CUDAToolkit package, which is available with CMake 3.17 and newer:
find_package(CUDAToolkit REQUIRED)
...
target_link_libraries(target CUDA::cusparse)

VS 2015 compiling cocos2d-x 3.6 error Macro definition of snprintf conflicts with Standard Library function declaration

I compile cocos2d-x(version 3.6) using visual studio 2015, the error occurred, saying:
fatal error C1189: #error: Macro definition of snprintf conflicts with Standard Library function declaration
Almost the same question like this link
here
I try to follow the first answer and then search most results on cocos forum but also failed, I'm noob and really have no idea now ..
And here it's my source code where defined snprintf on header file stdio.h
#if defined snprintf
// This definition of snprintf will generate "warning C4005: 'snprintf': macro
// redefinition" with a subsequent line indicating where the previous definition
// of snprintf was. This makes it easier to find where snprintf was defined.
#pragma warning(push, 1)
#pragma warning(1: 4005)
#define snprintf Do not define snprintf as a macro
#pragma warning(pop)
#error Macro definition of snprintf conflicts with Standard Library function declaration
#endif
Could someone help me .. thanks!
I am getting the same error trying to build libsndfile-1. I solved it by building using VS2013 instead of VS2015. (I think it should be possible to simply install VS2013 Build Tools and build from VS2015).
edit: to install the VS2013 build toolset, run the VS2015 installer and select 'Windows 8.1 and Windows Phone 8.0/8.1 Tools'

Error accessing WinRT sensors in C++ desktop application

I am trying to access the WinRT sensors from a Win32 desktop application using C++/CX as mentioned here: https://software.intel.com/en-us/articles/using-winrt-apis-from-desktop-applications
When I include the C++/CX header file it causes an error when building the Win32 project.
Exact error text: "error C1190: managed targeted code requires a '/clr' option."
Since I am not using /clr code at all, this is a confusing error.
Any suggestions? Please educate me if there is a better way to do this.
The error you are getting is because you are compiling some files without /ZW option for compiler. Since you are able compile at least some files with WinRT extensions, but not others, your project configuration is inconsistent.
The option /ZW (enable WinRT extensions) has to be configured on the level of project (and not on the level of individual files). There are two ways to ensure your settings are consistent. First method is through UI in Visual Studio -- you have to go through all platforms/configurations on the project and ensure /ZW is enabled, then got through all indivudual .cpp files, and ensure they don't override project level settings. This is tedious and error prone. The easier method is to open .vcxproj in notepad and do the following:
Add this section at the beginnig of the file, under root Project node:
<ItemDefinitionGroup>
<ClCompile>
<CompileAsWinRT>true</CompileAsWinRT>
</ClCompile>
</ItemDefinitionGroup>
Search and remove any other places where <CompileAsWinRT> is defined.

mxmlc load-externs is ignored

I develop an ActionScript 3 project using FlashDevelop 4.
I have a main SWF holding all the code.
I want to export some of the main SWF code into modules.
I created a module to hold the separated logic (by extending ModuleBase).
I don't want the module SWF to reference anything that is available in the main SWF so i ran the main SWF compilation with -link-report and got a report.xml file holding all the main SWF references.
I tried to compile the module (mxmlc) while excluding any class or library in the main SWF using the load-externs=report.xml option.
The compilation gave me an error saying that some libraries references are missing, but the error message referenced classes that are suppose to be included only in the main SWF.
I checked the report.xml file and it does show that these classes are referenced.
I tried to run the compilation in 3 different ways and always got the same result:
Using the build current file in FlashDevelope and giving the file a header of the command that should be ran.
Using command line (windows).
Using Ant build script.
Does anyone have any idea why this could happen?
I would be happy to supply more information about my problem if it helps anyone guide me to a solution.
Thanks for the help!
It turns out that it did not ignore the load-externs.
The load-externs excluded some of the libraries and therefor these libraries were not found during compile time.
I solved the problem by adding the libraries path to the compilation.
This was done by addind the flag: -l+=lib\

Errors when Upgrading Flex 3.2 to 3.5

Here's are the errors:
VerifyError: Error #1053: Illegal override of allowInsecureDomain in _SwdModule_mx_core_FlexModuleFactory.
ReferenceError: Error #1065: Variable _SwdModule_mx_core_FlexModuleFactory is not defined.
SwdModule is a module used within the organization and there's an application that loads this (and various other modules) at run time.
I've read on other stack overflow and various web site that this error was caused because the modules and the main app. were compiled using different Flex SDKs. I verified and checked up on this, but all of my SWFs are compiling using 3.5.
Can anyone think of anything else why this error would be occuring?
Thanks.
If you have compiled on 3.5 then the problem is with a component SWC being moved to a different location from 3.2.
For instance: They moved the AdvancedDataGrid into the datavisualization.swc. If you are using this then you'll need to add that swc to your build path.
There may be some other components that were moved too.
Take a look at the 3.5 release notes to compare your component locations with the new version:
http://www.adobe.com/support/documentation/en/flex/3/releasenotes_flex3_sdk.html