I have used Export Makefile option from VC++ 6.0 project.
Getting this error
make -f simu.mak
simu.mak:4: *** missing separator. Stop.
These are few lines of my makefile
# Microsoft Developer Studio Generated NMAKE File, Based on simu.dsp
!IF "$(CFG)" == ""
CFG=simu - Win32 PC Debug
!MESSAGE No configuration specified. Defaulting to simu - Win32 PC Debug.
!ENDIF
!IF "$(CFG)" != "simu - Win32 PC Debug" && "$(CFG)" != "simu - Win32 PC Release"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "simu.mak" CFG="simu - Win32 PC Debug"
!MESSAGE
That is not a makefile. It's an nmake file (as it says, right at the top of the file :)). You cannot use GNU make with that makefile, you must use Windows nmake.
Related
Normally, I use check_cxx_compiler_flag to check whether a given flag is recognized by the currently used compiler. However, I have run into issues with MSVC where some default flags are causing the test to fail due to incompatible flags.
MWE:
cmake_minimum_required(VERSION 3.5)
project(MWE)
include(CheckCXXCompilerFlag)
set(CMAKE_CXX_FLAGS "" CACHE INTERNAL "" FORCE)
set(CMAKE_CXX_FLAGS_DEBUG "" CACHE INTERNAL "" FORCE)
set(CMAKE_CXX_FLAGS_RELEASE "" CACHE INTERNAL "" FORCE)
set(CMAKE_CXX_FLAGS_MINSIZEREL "" CACHE INTERNAL "" FORCE)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "" FORCE)
check_cxx_compiler_flag("/O2" FLAG_USABLE)
if (NOT FLAG_USABLE)
message(FATAL_ERROR "Flag not usable")
endif()
When this is run on Windows in a developer command prompt, the test fails and the error log contains
Run Build Command(s):C:/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Current/Bin/amd64/MSBuild.exe cmTC_e3d37.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=17.0 /v:m && MSBuild version 17.3.1+2badb37d1 for .NET Framework
Microsoft (R) C/C++ Optimizing Compiler Version 19.33.31630 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
cl /c /Zi /W1 /WX- /diagnostics:column /O2 /Ob0 /D _MBCS /D FLAG_USABLE /D "CMAKE_INTDIR=\"Debug\"" /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_e3d37.dir\Debug\\" /Fd"cmTC_e3d37.dir\Debug\vc143.pdb" /external:W1 /Gd /TP /errorReport:queue "D:\a\cmake-compiler-flags\cmake-compiler-flags\test\build\CMakeFiles\CMakeTmp\src.cxx"
cl : command line error D8016: '/O2' and '/RTC1' command-line options are incompatible
which clearly shows that the flag is recognized, but it just does not play nicely with the /RTC1 flag, which somehow still gets added to the build.
How can I get rid of these default options (or at least all that are not essential for a build to complete), regardless of the used build configuration, so that my test really checks whether the compiler understands the given flag?
I guess your IDE - Visual Studio is adding this compilation flag. Try running Cmake from command line and the problem should be solved. In order to change VS behavior go to Solution -> Properties -> Configuration Properties -> C/C++ -> Code Generation -> Basic Runtime Checks and change the value of this flag to default or disabled.
I get the linker error fatal error C1107: could not find assembly 'platform.winmd': please specify the assembly search path using /AI or by setting the LIBPATH environment variable when I try to compile a C++/CX program on the command line.
The error is the same after I followed the instructions on this page: https://msdn.microsoft.com/en-us/library/dn769142.aspx (to summarize: run cl /ZW /EHsc source.cpp from the Developer Command Prompt for VS2015)
I also tried running vcvarsall.bat x86 store from the Developer Command Prompt for VS2015 but I still get the same error (the same error also happens when running vcvarsall.bat x86 store from a plain command prompt).
UPDATE: Apparently this bug has been fixed in VS2015 Update 1, I have not been able to test myself yet though.
As it turns out some command line parameters are missing from the documentation mentioned in the question, here is the full command line required to compile a small program:
cl /ZW
/ZW:nostdlib
/D WINAPI_FAMILY=WINAPI_FAMILY_APP
/D __WRL_NO_DEFAULT_LIB__
/Gm-
/EHsc
/MDd
/FU"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\store\references\platform.winmd"
/FU"C:\Program Files (x86)\Windows Kits\10\References\Windows.Foundation.FoundationContract\1.0.0.0\Windows.Foundation.FoundationContract.winmd"
/FU"C:\Program Files (x86)\Windows Kits\10\References\Windows.Foundation.UniversalApiContract\1.0.0.0\Windows.Foundation.UniversalApiContract.winmd"
smurf.cpp
/link /SUBSYSTEM:CONSOLE
Where smurf.cpp contains:
using namespace Platform;
int main(Platform::Array<Platform::String^>^ args)
{
Platform::Details::Console::WriteLine("This is a C++/CX program.");
}
Will successfully print:
C:\Users\Mikael>smurf.exe
This is a C++/CX program.
I'm trying to build libvpx 1.3.0 under Visual Studio 2012 (vs11) under windows 8.1 (x64).
I read the build prerequisites (http://www.webmproject.org/code/build-prerequisites/) and configured libvpx as following:
./configure --target=x86-win32-vs11 --disable-examples --disable-docs --disable-unit-tests
After the configure i do a make, without errors. But when i lauch the solution under Visual Studio and try to build, i get those path error:
1>------ Build started: Project: obj_int_extract, Configuration: Release Win32 ------
1> obj_int_extract.c
1>c1 : fatal error C1083: Cannot open source file: '.\\home\Thomas\libvpx-v1.3.0\build\make\obj_int_extract.c': No such file or directory
2>------ Build started: Project: vpx, Configuration: Release Win32 ------
2>cl : Command line warning D9002: ignoring unknown option '/home/Thomas/libvpx-v1.3.0/vp8/encoder/vp8_asm_enc_offsets.c'
2>cl : Command line error D8003: missing source filename
2> 'obj_int_extract.exe' is not recognized as an internal or external command,
2> operable program or batch file.
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(124,5): error MSB3073: The command "call obj_int_extract.bat /home/Thomas/libvpx-v1.3.0
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(124,5): error MSB3073: :VCEnd" exited with code 1.
========== Build: 0 succeeded, 2 failed, 0 up-to-date, 0 skipped ==========
I tryed both MSYS and Cygwin, same result.
Any idea ?
Ok, problem fixed:
The 1.3.0 snapshot seems to be faulty, cloning the git was the solution, it will probably be gone in the next snapshot.
Configured with Cygwin, MSYS was missing a perl module.
I am working a project that uses the Discrete Gaussian Image Filter within ITK. I am using CMake to automate the build process but it seems that CMake is leaving out certain ITK libraries during the configuration/generate step. I am currently using other headers in the ITK library without any issue. There are no configuration error messages in CMake for the project.
The CMakeLists.txt for my project:
#PROJECT(REGISTRATION)
#
# List of source files
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
# Top of file: the name of the program
PROJECT(MultiObjModelToUSReg)
INCLUDE_REGULAR_EXPRESSION("^.*$")
FIND_PACKAGE( ITK REQUIRED)
IF( ITK_FOUND )
INCLUDE( ${USE_ITK_FILE} )
ENDIF( ITK_FOUND )
# Directories to search for #include (add more if needed)
# (ITK is already included through the use of INCLUDE(${ITK_USE_FILE})
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}
src
)
# Name of the executable
#SET(MultiObjModelToUSReg MultiObjModelToUSReg_EXE)
# All source files (only .cxx, not .h or .txx)
SET(MultiObjModelToUSReg_SRCS
src/Utilities.cpp
src/MultiObjModel.cpp
src/USVolume.cpp
src/Registration.cpp
src/BoneProbabilityMap.cpp
#src/MultiObjModelToUSRegistration.cpp
#src/USRegistrationDialog.cpp
#src/MainPanel.cpp
#src/ModelRegistration.cxx
)
#only .h files that use QT_ macros!
#SET(MultiObjModelToUSReg_HEADERS
#src/USRegistrationDialog.h
#src/MainPanel.h
#src/ModelRegistration.h)
#SET(MultiObjModelToUSReg_FORMS
##ui/USRegistrationDialog.ui
##ui/MainPanel.ui
#ui/ModelRegistration.ui)
#SET(MultiObjModelToUSReg_RESOURCES)
# These two lines will compile and link your executable
#ADD_EXECUTABLE(MultiObjModelToUSReg
#${MultiObjModelToUSReg_EXE}
#${MultiObjModelToUSReg_SRCS}
#${MultiObjModelToUSReg_HEADERS_MOC}
#${MultiObjModelToUSReg_FORMS_HEADERS}
#${MultiObjModelToUSReg_RESOURCES_RCC}
#)
ADD_LIBRARY(MultiObjModelToUSReg STATIC ${MultiObjModelToUSReg_SRCS})
TARGET_LINK_LIBRARIES(MultiObjModelToUSReg ${ITK_LIBRARIES} )
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
ENABLE_TESTING()
INCLUDE(CTEST)
IF (BUILD_TESTING)
ADD_SUBDIRECTORY (Test)
ENDIF (BUILD_TESTING)
CMake's error-free output:
Check for working C compiler using: Visual Studio 9 2008
Check for working C compiler using: Visual Studio 9 2008 -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working CXX compiler using: Visual Studio 9 2008
Check for working CXX compiler using: Visual Studio 9 2008 -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Configuring done
Generating done
However, when I compile in Visual C++ 2008:
1>------ Build started: Project: MultiObjModelToUSReg, Configuration: Debug Win32 ------
1>Compiling...
1>BoneProbabilityMap.cpp
1>..\src\BoneProbabilityMap.cpp(8) : fatal error C1083: Cannot open include file: 'itkDiscreteGaussianImageFilter.h': No such file or directory
1>Build log was saved at "file://c:\MultiObjModelToUSReg\bin\MultiObjModelToUSReg.dir\Debug\BuildLog.htm"
1>MultiObjModelToUSReg - 1 error(s), 0 warning(s)
2>------ Skipped Build: Project: ALL_BUILD, Configuration: Debug Win32 ------
2>Project not selected to build for this solution configuration
========== Build: 0 succeeded, 1 failed, 12 up-to-date, 1 skipped ==========
While there is a workaround to manually it into the project's configuration, I will need to collaborate with others so it would be ideal to have the build process automated.
Any help would be greatly appreciated! (I am quite new to Stackoverflow, please let me know if I made anything unclear).
You need to build ITK with ITK_BUILD_ALL_MODULES=ON.
I am using a mix of Java and native JNI C++ code for an android project, using NDK r8b, in Eclipse in OSX. I want to be able to use the regular C++ classes (map, string) in std namespace.
In the Android.mk file the following were added:
APP_STL := stlport_shared
Here I also tried static library. Refer to http://docs.huihoo.com/android/ndk/r5/CPLUSPLUS-SUPPORT.html
STLPORT_FORCE_REBUILD := true
Also tried removing the forced build.
In the C/C++ path and variables:
${NDKROOT}/sources/cxx-stl/stlport/stlport
"map" and "string" headers were included in the .cpp file. I am able to use std::string and std::map. The assistant picks up on them. When searching for the definition (F3 in eclipse) the header file is shown, i.e. resolved. Also, the outline shows the "string" and "map" header files and when double clicking them it also brings the headers to the forefront.
However, the build doesn't pick them up. I get the following:
> ndk-build
> Gdbserver : [arm-linux-androideabi-4.6] libs/armeabi/gdbserver
> Gdbsetup : libs/armeabi/gdb.setup
> Gdbserver : [arm-linux-androideabi-4.6] libs/armeabi-v7a/gdbserver
> Gdbsetup : libs/armeabi-v7a/gdb.setup
> Compile++ arm : ImageTargets <= ImageTargets.cpp
> xxx/Project/Code/MyImageTarget/jni/ImageTargets.cpp:20:18: fatal error: string: No such file > or directory
> compilation terminated.
> make: *** [xxx/Project/Code/MyImageTarget/obj/local/armeabi/objs-> debug/ImageTargets/ImageTargets.o] Error 1
Has anyone any idea what else is there to try.
Use V=1 parameter on ndk-build command line. This will echo all executed commands, including compilation and link, with all their parameters that NDK build assigns.
In your case, the answer can be found without detailed build log:
In the Android.mk file the following were added:
APP_STL := stlport_shared
This is your mistake. The document you cited explains that this setting should go into Application.mk. This file is usually considered optional. Yes it is. Instead of creating this file, you can specify APP_STL on the command line:
ndk-build V=1 APP_STL=stlport_static
I don't know why and how Eclipse resolves #include <string> or map.