CMAKE Windows program prints nothing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Xillez
    New Member
    • Jul 2013
    • 93

    CMAKE Windows program prints nothing

    Hey, I've had an project on Linux, but I wanna also be able to work on windows, now the CMakeLists.txt file apparently can make the makefile using MinGW or Cygwin's g++. Once the program is built with mingw32-make or cygwin's make command and ran, it does nothing.

    Running in GDB it states "(gdb) During startup program exited with code 0xc0000139.", Do anyone know what this means? No very useful info found so far.

    I was wondering if anyone see what's wrong with the CMakeLIsts.txt file or my configuration?

    Cygwin and mingw is in my path and I've verified it can find them.

    I'm using a configuration header "Config.hpp " which cmake sets up based on whether it's debug or release. This should be working correctly and the program should so "printf("DE BUG BUILD!\n");" if it is a debug build. It did at one point print, but I can't see why it wont now.

    CMakeLists.txt:
    Code:
    # Set cmake minimum
    cmake_minimum_required(VERSION 3.11)
    
    set(BUILD_TYPE_DEBUG "Debug")
    set(BUILD_TYPE_RELEASE "Release")
    set(CMAKE_BUILD_TYPE ${BUILD_TYPE_DEBUG})
    set(BUILD_TYPE ${BUILD_TYPE_DEBUG})
    set(PROJECT_VERSION "v0.1")
    
    # Set cmake options
    set(CMAKE_CXX_STANDARD 14)
    set(CMAKE_CXX_STANDARD_REQUIRED ON)
    set(CMAKE_CXX_EXTENSIONS OFF)
    set(CMAKE_C_COMPILER gcc)
    set(CMAKE_CXX_COMPILER g++)
    set(CMAKE_GENERATOR "Unix Makefiles" CACHE INTERNAL "" FORCE)
    
    # Set project name
    set(PROJECT_NAME "ecs")
    
    # Set project name
    project(${PROJECT_NAME})
    
    # Set the output to the bin folder
    set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
    set(PROJECT_SOURCE_DIR ${PROJECT_SOURCE_DIR}/source)
    set(CMAKE_SOURCE_DIR ${PROJECT_SOURCE_DIR})
    
    # Configure a header file to pass some of the CMake settings
    # to the source code
    configure_file(
      "${PROJECT_SOURCE_DIR}/config/Config.hpp.in"
      "${PROJECT_SOURCE_DIR}/config/Config.hpp"
      @ONLY
    )
    
    # Add all cpp files used in the program
    add_executable(${PROJECT_NAME} 
    	#src
      ${PROJECT_SOURCE_DIR}/src/main.cpp
    )
    main.cpp:
    Code:
    #include "../config/Config.hpp"
    
    #include <stdio.h>
    #include <iostream>
    
    int main(int argc, char const *argv[])
    {
    	#if IS_BUILD_TYPE_DEBUG()
    		printf("DEBUG BUILD!\n");
    	#endif
    	#if defined(PROJECT_VERSION)
    		printf("Project version: %s\n", PROJECT_VERSION);
    	#endif
    }
    Last edited by Xillez; Dec 19 '18, 02:15 PM. Reason: Added GDB print
Working...