Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. [ 25%] Building CXX object say-hello/CMakeFiles/say-hello.dir/src/say-hello/hello.cpp.o
  2. <command-line>:0:14: warning: ISO C++11 requires whitespace after the macro name
  3. /home/maximilian/Dokumente/02_Programmieren/VSCMAKE/say-hello/src/say-hello/hello.cpp: In function ‘void hello::say()’:
  4. <command-line>:0:17: error: expected ‘;’ before numeric constant
  5. /home/maximilian/Dokumente/02_Programmieren/VSCMAKE/say-hello/src/say-hello/hello.cpp:7:43: note: in expansion of macro ‘HELLO_VERSION’
  6. std::cout << "Hello (Version " << HELLO_VERSION << ")n";
  7. ^~~~~~~~~~~~~
  8. say-hello/CMakeFiles/say-hello.dir/build.make:62: recipe for target 'say-hello/CMakeFiles/say-hello.dir/src/say-hello/hello.cpp.o' failed
  9. make[2]: *** [say-hello/CMakeFiles/say-hello.dir/src/say-hello/hello.cpp.o] Error 1
  10. CMakeFiles/Makefile2:90: recipe for target 'say-hello/CMakeFiles/say-hello.dir/all' failed
  11. make[1]: *** [say-hello/CMakeFiles/say-hello.dir/all] Error 2
  12. Makefile:83: recipe for target 'all' failed
  13. make: *** [all] Error 2
  14.  
  15. cmake_minimum_required(VERSION 3.14.4)
  16. project(MyProject VERSION 1.0.0)
  17. set(CMAKE_CXX_STANDARD 11)
  18.  
  19. add_subdirectory(say-hello)
  20. add_subdirectory(mainsrc)
  21.  
  22. add_executable(main.out main.cpp)
  23.  
  24. target_link_libraries(main.out PRIVATE say-hello)
  25.  
  26. #include <iostream>
  27. #include <say-hello/hello.hpp>
  28.  
  29. int main(){
  30. hello::say();
  31. return 0;
  32. }
  33.  
  34. add_library(say-hello
  35. src/say-hello/hello.cpp
  36. src/say-hello/hello.hpp
  37. )
  38.  
  39. target_include_directories(say-hello PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/src")
  40.  
  41. target_compile_definitions(say-hello PUBLIC HELLO_VERSION-4)
  42.  
  43. #ifndef HELLO
  44. #define HELLO
  45.  
  46. //#define SAYHELLOVERSION 4
  47.  
  48. namespace hello{
  49. void say();
  50. }
  51.  
  52. #endif
  53.  
  54. #include <iostream>
  55. #include "hello.hpp"
  56.  
  57. namespace hello{
  58. void say(){
  59. //int version = SAYHELLOVERSION;
  60. std::cout << "Hello (Version " << HELLO_VERSION << ")n";
  61. }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement