473,405 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

CMAKE Windows program prints nothing

93 64KB
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("DEBUG 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:
Expand|Select|Wrap|Line Numbers
  1. # Set cmake minimum
  2. cmake_minimum_required(VERSION 3.11)
  3.  
  4. set(BUILD_TYPE_DEBUG "Debug")
  5. set(BUILD_TYPE_RELEASE "Release")
  6. set(CMAKE_BUILD_TYPE ${BUILD_TYPE_DEBUG})
  7. set(BUILD_TYPE ${BUILD_TYPE_DEBUG})
  8. set(PROJECT_VERSION "v0.1")
  9.  
  10. # Set cmake options
  11. set(CMAKE_CXX_STANDARD 14)
  12. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  13. set(CMAKE_CXX_EXTENSIONS OFF)
  14. set(CMAKE_C_COMPILER gcc)
  15. set(CMAKE_CXX_COMPILER g++)
  16. set(CMAKE_GENERATOR "Unix Makefiles" CACHE INTERNAL "" FORCE)
  17.  
  18. # Set project name
  19. set(PROJECT_NAME "ecs")
  20.  
  21. # Set project name
  22. project(${PROJECT_NAME})
  23.  
  24. # Set the output to the bin folder
  25. set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
  26. set(PROJECT_SOURCE_DIR ${PROJECT_SOURCE_DIR}/source)
  27. set(CMAKE_SOURCE_DIR ${PROJECT_SOURCE_DIR})
  28.  
  29. # Configure a header file to pass some of the CMake settings
  30. # to the source code
  31. configure_file(
  32.   "${PROJECT_SOURCE_DIR}/config/Config.hpp.in"
  33.   "${PROJECT_SOURCE_DIR}/config/Config.hpp"
  34.   @ONLY
  35. )
  36.  
  37. # Add all cpp files used in the program
  38. add_executable(${PROJECT_NAME} 
  39.     #src
  40.   ${PROJECT_SOURCE_DIR}/src/main.cpp
  41. )
  42.  
main.cpp:
Expand|Select|Wrap|Line Numbers
  1. #include "../config/Config.hpp"
  2.  
  3. #include <stdio.h>
  4. #include <iostream>
  5.  
  6. int main(int argc, char const *argv[])
  7. {
  8.     #if IS_BUILD_TYPE_DEBUG()
  9.         printf("DEBUG BUILD!\n");
  10.     #endif
  11.     #if defined(PROJECT_VERSION)
  12.         printf("Project version: %s\n", PROJECT_VERSION);
  13.     #endif
  14. }
  15.  
Dec 19 '18 #1
0 1667

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: radnus2004 | last post by:
main() { static int a = {1,2,3}; printf("&a-&a=%u\n",&a-&a); } If you compile the above program and run it prints 1. Why? I printed &a and &a separately and the difference
4
by: Kristof Despiere | last post by:
Suppose you have one domain, filled with a couple of users. What needs to be done now is I need to start a windows application from a webform by pressing a button on the webform (for example). ...
6
by: AP | last post by:
Hello, I am having trouble trying to assign an object to a running program in windows in VB.NET A COM component class with the same name as the windows program is avaliable to use in VB.NET. The...
17
by: UJ | last post by:
Is there any way for a windows service to start a windows program ? I have a service that will need to restart a windows app if it needs to. TIA - Jeff.
1
by: innuendo | last post by:
Is it possible to access a windows program through our code in C++? For example, to access Winamp and do whatever it's possible to do by directly accessing its GUI. Open an audio file and listen...
0
by: Chico Jayanthan | last post by:
Hi, I call an external windows program (.exe) from a python script. Something like os.system('test.exe'). I want to set a timeout for the external windows program to return. If no results are...
5
by: drhowarddrfine | last post by:
I have an open source Windows program I would like to port to FreeBSD. I tried compiling it 'as is' and, so far, it only trips up on MS/Windows definitions, such as 'ulong'. Is there a...
2
by: Mufasa | last post by:
I have a .Net 1.1 program that works fine that plays flash files. I am converting it to .Net 2.0 and am getting all kinds of compilation errors about not finding files or assemblies. Here's the...
3
by: Mufasa | last post by:
I need to write a windows program in C# that will display a word document on the screen without having Word loaded on the machine. How can I do this? TIA - J.
9
by: Syed Hadi | last post by:
Hi I am having windows program with back end sqlserver its running successfully on windows but my boss want that program to be run on android iPad. Can Any one help out how to change windows base...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.