How link in cmake .winmd files? - visual-c++

I have already try:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -AI\"C:/Path/to/winmd/file.winmd\"")
and try target_link_libraries:
target_link_libraries(${APP_TARGET_NAME} C:/Path/to/winmd/file.winmd
didn't works.
In Visual Studio project of example the same winmd file attached in "References" section.

Related

CMake linking glfw3 lib error

i'm working with CLion, and I'm writing a program using the glfw3 lib.(http://www.glfw.org/docs/latest/)
I installed and did everything correctly for the lib i have the .a and .h files in:
/usr/local/lib/libglfw3.a
/usr/local/include/.h(all files)
I'm trying to use the library now, but i'm getting the linker error:
undefined reference to 'glViewport' etc. etc. all the functions i'm using
I added the lib path to the make file, I can't understand what i'm doing wrong, my CMakeLists.txt looks like this:
cmake_minimum_required(VERSION 3.6)
project(testing)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(SOURCE_FILES main.cpp examples.h)
add_executable(testing ${SOURCE_FILES})
target_link_libraries(testing /usr/local/lib/libglfw3.a)
target_link_libraries(testing /usr/local/lib/libTest.a)
target_link_libraries(testing pthread)
any help will be appreciated.
Thanks!
You should not hard code absolute paths into your CMake files. This renders CMake useless.
In the documentation of GLFW on how to link against it, there it is explicitly written:
find_package(glfw3 3.2 REQUIRED)
find_package(OpenGL REQUIRED)
target_include_directories(myapp PUBLIC ${OPENGL_INCLUDE_DIR})
target_link_libraries(myapp
glfw
${OPENGL_gl_LIBRARY})
Moreover, you can replace
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
with
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
and CMake will figure out the correct compiler flag automatically depending on the compiler currently in use.

linking against library using VS and CMake on windows

I'm new to the world of cmake and linking to libaries. Now for a project I need to include a third party library in the current application. However I'm having problems linking to the library.
Here is what I have:
The library is build in the location D:/qwt-6.1.2, which contains:
the folder /src with the header and source files
the folder /lib which contains (qwt.dll, qwt.ext, qwt.lib, qwtd.dll, qwtd.ext, qwtd.ilk, qwtd.lib and qwtd.pdb.
I have tried to add the following to the cmake file:
add_executable(Demo main.cpp mainwindow.cpp mainwindow.h )
include_directories(D:/qwt-6.1.2/src)
link_directories(D:/qwt-6.1.2/lib)
target_link_libraries(Demo qwt)
The including goes fine since the intellisense of visual studio can the includes that I do, however when I build I get the error:
Error 1 error LNK1104: cannot open file 'qwt.lib'
Does anybody have an idea what I'm doing wrong? I don't care at the moment if it is statically or dynamically linked.

how to compile in vc++ without .dsw workspace file?

I downloaded a source code from codeproject.com
In the zip file only .cpp files and .hpp files were present but no .dsw (vc++ work space) file.
how to compile the files in vc++.
source code link: http://www.codeproject.com/Articles/13852/BasicExcel-A-Class-to-Read-and-Write-to-Microsoft
As far as I know, vc++ requires a dsw. That said, you can easily create one by creating a project + workspace and add import all the files into the project.
Unless the code requires special compile options (unlikely if it comes without a project file), this should work fine.
When you compile in VisualC++ cl.exe is executed in order to compile a s program.
So a way to compile that does not require dsw file might be running compilation in command line. This is an example for a source file main.cpp:
call vsvars32.bat && cl /MD /Od /EHsc /GR /Zi /Oy- main.cpp
On my computer the full path to vsvars32.bat is
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat
dsw is an ancient format, and is replaced by .sln and .vcxproj files. What I would suggest would be File -> New -> Project from existing code, browse to the directory with the cpp/hpp files and let Visual Studio create the project with default compiler switches - so you won't have to run cl.exe from the command line as suggested here.
That being said, the chances of circa-2006 c++ code to work on IDEs 4 versions later are small. You will almost certainly have to understand and fix the code - or find a more recent one that does what you need.

Compiling cocos2d cannot find module with tag 'libjpeg'

I have installed correctly the Android SDK, Android NDK, eclipse, and I have the last repository's cocos2d from git.
I have followed the steps in the wiki to generate a project and I have done correctly.
The problem comes when I run ./build_native.sh, I get this error:
Cannot find module with tag 'libjpeg' in import path
I have checked the Android.mk, and I suppose that the error is in the final zone:
LOCAL_WHOLE_STATIC_LIBRARIES := cocos_libpng_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_jpeg_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_libxml2_static
# define the macro to compile through support/zip_support/ioapi.c
LOCAL_CFLAGS := -DUSE_FILE32API
include $(BUILD_SHARED_LIBRARY)
$(call import-module,libjpeg)
$(call import-module,libpng)
$(call import-module,libxml2)
I have read the steps several times, and I didn't forget (I think) anything. Could someone who have been compiled the code help me please?
The complete error is:
Android NDK: jni/../../../cocos2dx/Android.mk: Cannot find module with tag 'libjpeg' in import path
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?
Android NDK: The following directories were searched:
Android NDK:
make: Entering directory `/home/pipero/git_checkout/cocos2d-x/PiperoStest/android'
Thanks in advance.
EXTRA: I have created the project using the: $COCOS2D>create-linux-eclipse-project.sh and i can't open the project in eclipse neither to compile using ndk from eclipse directly.
EXTRA2: The steps are from HERE
EXTRA3: I already changed the NDK_ROOT_LOCAL="$LIBS/android-ndk-r7b"
ANDROID_SDK_ROOT_LOCAL="$LIBS/android-sdk-linux"
I followed steps below with version 0.12.0 (2012-03-05) and it worked:
1º Install NDK Android
2º Install SDK Android
3º Instal Android plug-in on Eclipse.
4º Download ./create-android-project.sh with NDK and SDK paths.
5º Compile a new project with ./create-linux-eclipse-project.sh
Choose ID (android). If you get a warning that means it cannot find NDK.
Name of the project
It'll be create on current folder.
6º Compile Cocos2d libs inside project folder with ./build_native.sh.
7º Create new Android project from source code in project's folder > android.
8º Run the project and it should appear Cocos2d wallpaper.
I fixed this by adding the following to Android.mk in the cocos2d directory:
$(call import-add-path, $(LOCAL_PATH)/platform/third_party/android/prebuilt)
This was added just before this section, which is at the bottom of the file:
$(call import-module,libjpeg)
$(call import-module,libpng)
$(call import-module,libtiff)
$(call import-module,libwebp)

Error LNK1104: cannot open file 'python27.lib' PyISAPIe

Am trying to compile a 64bit version of PyISAPIe using VS2010. Am not used to C/C++ programming but managed to configure some settings for VS2010. Everything went well until it got to the linking stage where it gave the above mentioned error. I checked all the Library path settings and they looked fine. Below is my command line for building the DLL:
/OUT:"x64\Release\PyISAPIe.dll" /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\pyisapie\Python\x64\Python27\libs" /LIBPATH:"C:\pyisapie\Python\x64\Python26\libs" /LIBPATH:"C:\pyisapie\Python\x64\Python25\libs" /DLL "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /NODEFAULTLIB:"libc libcmt msvcrt" /DEF:"PyISAPIe.def" /MANIFEST /ManifestFile:"x64\Release\PyISAPIe.dll.intermediate.manifest" /ALLOWISOLATION /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /PDB:"C:\pyisapie\x64\Release\PyISAPIe.pdb" /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /PGD:"C:\pyisapie\x64\Release\PyISAPIe.pgd" /LTCG /TLBID:1 /DYNAMICBASE:NO /IMPLIB:"x64\Release\PyISAPIe.lib" /MACHINE:X64 /ERRORREPORT:QUEUE
The path C:\pyisapie\Python\x64\Python27\libs exists and containes python27.lib.
Can anyone help me out. Thanks in advance
I just compared your linker command line to mine (I'm the project author) and it's exactly the same as far as flags go, so you might want to look into other reasons why the file can't be opened. Is it an x64 lib for sure? Do you have access?
You might try reinstalling the newest 2.7 x64 release into a different location and add that folder instead.
I had the same issue due to not setting the LIBPATH correctly. This may not be the cause of your error message, but it was the cause of mine.
To resolve it in Visual Studio right click on the PyISAPIe project and select:
Properties > Configuration Properties > Linker > General
Then make sure that the path C:\pyisapie\Python\x64\Python27\libs (or the relative path) is listed in the "Additional Library Directories"

Resources