学习写hello world
配置好cmake环境后
创建CMakeLists.txt
创建hello.c
运行cmake
运行make,然后运行hello
阅读(0) | 评论(0) | 转发(0) |
<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
配置好cmake环境后
创建CMakeLists.txt
- PROJECT (HELLO)
- SET(SRC_LIST hello.c)
- MESSAGE(STATUS "This is BINARY dir " ${HELLO_BINARY_DIR})
- MESSAGE(STATUS "This is SOURCE dir "${HELLO_SOURCE_DIR})
- ADD_EXECUTABLE(hello ${SRC_LIST})
- #include <stdio.h>
-
- int main()
- {
- printf("Hello World.\n");
- return 0;
- }
- cmake .
- myfly@ubuntu:~/mycmake/hello$ cmake .
- CMake Warning (dev) in CMakeLists.txt:
- Syntax Warning in cmake code at
-
- /home/myfly/mycmake/hello/CMakeLists.txt:4:37
-
- Argument not separated from preceding token by whitespace.
- This warning is for project developers. Use -Wno-dev to suppress it.
-
- -- This is BINARY dir /home/myfly/mycmake/hello
- -- This is SOURCE dir /home/myfly/mycmake/hello
- -- Configuring done
- -- Generating done
- -- Build files have been written to: /home/myfly/mycmake/hello
- make
- ./hello
- Hello World.
给主人留下些什么吧!~~
评论热议