How to run c++ and c together in WinRT project - c++

I have a file name as sqlite3.c and some c++ file use to work with the function write in sqlite3.c. But I face a problem to compile the file using visual studio 2012. I create a WindowsRuntimeComponent project for the c++ file and c file. When I set Properties -> C/C++ -> Advanced -> Compile As -> "Compile as C++ Code (/TP)", I get an error which is error D8045: cannot compile C file 'xxx.c' with the /clr option.
After that, I change Properties -> C/C++ -> Advanced -> Compile As -> "Compile as C Code (/TC)", I get an error which is error D8045: cannot compile C file 'xxx.cpp' with the /clr option.
I don't have an idea to solve this problem. Can anyone give me a help? Thank you.

Related

Trying to move a MSVC2008 project to MSVC2017

I'm trying to move this project form VisualStudio 2008 to VisualStudio 2017. This project is a C++ project and when I try to compile it there are a lot of errors:
Errors are:
the source file can not be opened (E1696).
the global scope does not have... (E0282).
the identifier ... is not defined (E0020).
The solution file of the project is in the folder kex3_anubis/msvc/
The project is open source.
# EDIT
I have lowered the number of errors to 17, but there are 126 warnings. What I have done is to select Project -> redirect projects (2nd option of project menu) and select Windows SDK version to 10.0.15063.0. I don't know if this is a good step or is not part of the solution, because it's the first time that I'm trying to move a project from different versions of VS.
The new errors are:
The declaration of ... hides the previous local statement (C4456)
Warning treated as error; no generated 'object' file (C2220)
The other errors have disappeared.
# EDIT 2
For the moment I applied this solution found on other question:
Go to project properties -> configurations properties -> C/C++ ->
treats warning as error -> No (/WX-).
Now I only have one error.
can not open the file '...\openal\lib\ eaxguid.lib' from anubis project
instead of
#include "math.h"
use
#include <math.h>
In all the standard includes

How to link a C project with a C++ static library(using opencv) in eclipse

I have created a c++ static library in eclipse which is using opencv.It is build fine and I want to include it in another c project in the same workspace.
Trying with
1)I have included library path in properties->c/c++ build->setting ->GCC C compiler ->Includes ->"path of project".
2)properties->c/c++ build->setting ->GCC C Linker-> Libraries ->Liraries(-i)->"Name of Lib"
3).properties->c/c++ build->setting ->GCC C Linker-> Libraries ->Liraries(-i)->"path of Lib"
But,this is not working while running the c project cannot find the static library functions giving error -"UNDEFINED REFERENCE TO THE FUNCTION"
Suggest a way to solve the problem.
Thanks in advance.
Got the answer.
These are the files needed to include
"${workspace_loc:/staticLibrary}"
MSDK/include
/IPP_Legacy/x64/include
Levmar/x64/include
/opencv/lib
opengl/x64/include/GL
Tesseract/x64/include/tesseract
freeGLUT/x64/include/GL
/ffmpeg/x64/include/libavcodec
compilers_and_libraries_2016.3.210/linux/ipp/include
compilers_and_libraries_2016.3.210/linux/mkl/include
compilers_and_libraries_2016.3.210/linux/tbb/include
compilers_and_libraries_2016.3.210/linux/daal/include
After these inclusion I faced a error of
/usr/lib/x86_64-linux-gnu/libstdc++.so.6: error adding symbols: DSO missing from command line
for which I got help from the link
http://i0.wp.com/omtlab.com/wp-content/uploads/2013/07/4.png
now the program is working all fine
Thank you

Eclipse c++, how to add std11?

I have installed:
Eclipse IDE for C/C++ Developers
Version: Mars.1 Release (4.5.1)
And I'm tring to execute a working code (already tested).
So I have done:
File -> New -> C++ Project
Than I click on next, next, finish... so without changing anything.
As it is suggested in http://wiki.eclipse.org/CDT/User/FAQ:
Open Project Properties->C/C++ Build->Settings->Tool Settings->GCC C++ Compiler->Miscellaneous->Other Flags. Put "-std=c++0x" at the end.
Than I did the following:
Open Project Properties->C/C++ Build->Settings->Tool Settings->Cross G++ Compiler->Miscellaneous->Other Flags. Put "-std=c++0x" at the end.
I have tried to put -std=c++11 instead of -std=c++0x but nothing changed.
But I still got the following on-the-fly in-the-editor suggestion:
Symbol 'chrono' could not be resolved
The errors are like the following one: "Function 'now' could not be resolved"
No, Tom Mekken, I did not.
How can I set up the paths of the chrono library ?

C++; eclipse linker error

So working on getting my eclipse IDE going so I can develop my arduino uno in eclipse.
My C++ is weak so this is probably a nube error on my part.
I have a blink program that looks for an arduino library I compiled from the arduino IDE's library.
My code points to the header file and my code find it fine; meaning I can click on:
#include <arduino.h>
and go view the header
this: "C:/programs/arduino-1.0/hardware/arduino/cores/328p_lib/libuno_library.a"
is a valid path... but I get the following error:
>****** Build of configuration Debug for project project1 ****
>make all
>Building target: project1.elf
>Invoking: AVR C++ Linker
>avr-g++ -Wl,-Map,project1.map,--cref -L"C:\programs\arduino->1.0\hardware\arduino\cores\328p_lib" -mmcu=atmega328p -o "project1.elf" ./code/code1.o >-l"C:/programs/arduino-1.0/hardware/arduino/cores/328p_lib/libuno_library.a"
>c:/programs/winavr/bin/../lib/gcc/avr/4.3.3/../../../../avr/bin/ld.exe: cannot find ->lC:/programs/arduino-1.0/hardware/arduino/cores/328p_lib/libuno_library.a
>make: *** [project1.elf] Error 1
>**** Build Finished ******
Well after wasting 2 days or so of fun time I finally found the problem.
http://sourceforge.net/projects/avr-eclipse/forums/forum/664382/topic/4640554
When adding the static library to the linker you have to remove the lib prefix and the .a suffix. not sure what that is about.
Right click on the project>Click on C/C++ BUild> Settings > GCC C++ Linker> Libraries
Click the first icon Add> Add the library name ( without the .a suffix, the suffix will be added automatically)
This will ensure that the library is added to the project.
If the library is part of another project >Go to GCC C Compiler> directories >Add the directory
This will ensure that the library is there for getting the compilation done.

OpenCV 2.3 - undefined reference to cvCreateButton - Eclipse

I am trying to use the Qt new functions described here:
http://opencv.willowgarage.com/documentation/cpp/qt_new_functions.html#cv-createbutton
And I also found this topic on SO:
openCV 2.2 createButton LNK 2019 error in Visual Studio 2010
but compiling with QT didn't work.
Anyway, according to my searches it seems to be a linking problem. My doubt is that I already compiled OpenCV (without QT) but I can use the createTrackbar normally.
I tried using the createButton as this:
cv::createButton("buttonCanny", buttonCallBackCanny,NULL,CV_RADIOBOX,true);
But I get this error:
undefined reference to `cv::createButton(std::string const&, void
()(int, void), void*, int, bool)'
I tried the cvCreateButton but I get the same error.
I have this setup
C/C++ Build -> Settings -> Tool Settings -> MingGW C++ Linker -> Libraries (all the .dll from compiled OpenCV)
libopencv_calib3d230
opencv_ffmpeg
libopencv_contrib230
libopencv_core230
libopencv_features2d230
libopencv_flann230
libopencv_gpu230
libopencv_highgui230
libopencv_imgproc230
libopencv_legacy230
libopencv_ml230
libopencv_objdetect230
libopencv_video230
C/C++ Build -> Settings -> Tool Settings -> MingGW C++ Linker -> Search Path ("C:\opencvbin\bin" where the Dll are)
C/C++ Build -> Settings -> Tool Settings -> GCC C++ Compiler -> Includes
"C:\OpenCV2.3\build\include"
Any suggestions?
Thank you!
Ok, I made some mistakes.
Firstly, I wasn't downloading the source code of QT, only the SDK, without source code.
The necessary libs and executables where there.
Secondly, I had to add some entries in the CMake Gui,
I was ignoring this message:
Could NOT find Qt4 (missing: QT_QMAKE_EXECUTABLE QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE QT_UIC_EXECUTABLE QT_INCLUDE_DIR QT_LIBRARY_DIR QT_QTCORE_LIBRARY)
then, I set
QT_QMAKE_EXECUTABLE = C:\Qt\4.8.0\bin\qmake.exe
QT_MOC_EXECUTABLE = C:\Qt\4.8.0\bin\moc.exe
QT_RCC_EXECUTABLE = C:\Qt\4.8.0\bin\rcc.exe
QT_UIC_EXECUTABLE = C:\Qt\4.8.0\bin\uic.exe
QT_INCLUDE_DIR = C:\Qt\4.8.0\include
and it worked fine.
Trackbar seems to work without Qt, so they probably use their own implementation of a trackbar when there is no Qt available.
Thanks!