无法在Windows 7

时间:2017-04-27 15:08:42

标签: gcc makefile cmake

我结束了16个小时的配置,安装,删除,修改和敲击键盘多次....

我想将restbed用于平台独立的C ++编程,但我无法构建这些东西。我安装了Cygwin(在2017/04/24下载)(想想git或任何令人毛骨悚然的东西),Code :: Blocks with MinGW(16.01)和至少一个单独的MinGW(也下载2017/04/24)安装。我还在Windows 7 x64 Pro上使用Visual Studio 2012 Pro,2015和2017(长篇故事)。

这是我尝试的结果: 使用git在空目录中重新克隆并按照说明进行。

cmake -DBUILD_TESTS=YES -DBUILD_EXAMPLES=YES -DBUILD_SSL=NO -DBUILD_SHARED=YES ..

呃......成功。我似乎使用了Cygwin的gcc / g ++。

-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
:
:
-- Configuring done
-- Generating done
-- Build files have been written to: /cygdrive/d/Entwicklung/C++/restbed/restbed/build

尼斯!现在如下:

make -j install

工作7%后,它会发出一连串警告并失败:

/cygdrive/{my_path_to}/restbed/restbed/dependency/asio/asio/include/asio/detail/config.hpp:755:5: warning: #warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. [-Wcpp]
 #   warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately.
     ^
/cygdrive/{my_path_to}/restbed/restbed/dependency/asio/asio/include/asio/detail/config.hpp:756:5: warning: #warning For example, add -D_WIN32_WINNT=0x0501 to the compiler command line. [-Wcpp]
 #   warning For example, add -D_WIN32_WINNT=0x0501 to the compiler command line.
     ^
/cygdrive/{my_path_to}/restbed/restbed/dependency/asio/asio/include/asio/detail/config.hpp:757:5: warning: #warning Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target). [-Wcpp]
 #   warning Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target).
     ^
/cygdrive/{my_path_to}/restbed/restbed/dependency/asio/asio/include/asio/detail/config.hpp:781:5: error: #error You must add -D__USE_W32_SOCKETS to your compiler options.

我修改了config.hpp并添加了

#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif

定义bla'警告消失,但现在我应该设置' -D__USE_W32_SOCKETS'。

但在哪里?

在研究谷歌之后,我尝试设置环境变量CPPFLAGS = -D__USE_W32_SOCKETS,但这没有任何改变!

好的,现在我想给MinGW一个机会,但是如何摆脱这个渗透的Cygwin,没有卸载并搞乱其他软件?

很酷,我应该设置一些环境变量.... 清理build-Directory并按照cmake输出中的说明设置CC和CXX。

SET CC=D:/MinGW/bin/gcc.exe
SET CXX=D:/MinGW/bin/g++.exe

检查我的PATH变量并添加&#34 ;; D:\ MinGW \ mysys \ 1.0 \ bin; D:\ MinGW \ bin"

现在再次使用cmake bla ..但是......但......什么?

-- The C compiler identification is GNU 5.3.0
-- The CXX compiler identification is GNU 5.3.0
CMake Error at CMakeLists.txt:4 (project):
  The CMAKE_C_COMPILER:

    D:/MinGW/bin/gcc.exe

  is not a full path and was not found in the PATH.

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.


CMake Error at CMakeLists.txt:4 (project):
  The CMAKE_CXX_COMPILER:

    D:/MinGW/bin/g++.exe

  is not a full path and was not found in the PATH.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.


-- Configuring incomplete, errors occurred!
See also "/cygdrive/{my_path_to}/restbed/restbed/build/CMakeFiles/CMakeOutput.log".

使用Cygwin cmake说,我在GNU 5.4.0版本中使用gcc / g ++。另一方面,它检测到正确的MinGW版本为5.3.0,但无法找到它?胡?

如何让这个库在Windows 7下运行?

编辑开始

要为Code :: Blocks构建makefile,-G参数不起作用。我尝试了一些组合,但总是说:

cmake -DBUILD_TESTS=YES -DBUILD_EXAMPLES=YES -DBUILD_SSL=NO -DBUILD_SHARED=YES -G "CodeBlocks" ..
CMake Error: Could not create named generator CodeBlocks

Generators
  Unix Makefiles               = Generates standard UNIX makefiles.
  Ninja                        = Generates build.ninja files.
  CodeBlocks - Ninja           = Generates CodeBlocks project files.
  CodeBlocks - Unix Makefiles  = Generates CodeBlocks project files.
:    
:
cmake -DBUILD_TESTS=YES -DBUILD_EXAMPLES=YES -DBUILD_SSL=NO -DBUILD_SHARED=YES -G "CodeBlocks - Ninja" ..
CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

现在这个(许多被审查的词)想知道cmake-make?

我的错......不要考虑,我已经安装了什么。

" CodeBlocks - Unix Makefiles"按预期工作生成项目文件,但无法在Code :: Blocks下编译。我在'构建选项'中更改了项目的编译器。到Cygwin,但是说:

Execution of '/usr/bin/make.exe -j8 -f "/cygdrive/d/{my_path_to}/restbed/restbed/build/Makefile"  VERBOSE=1 all' in 'D:\{my_path_to}\restbed\restbed\build' failed.

......仅此而已。认为它与" Unix Makefile"在Windows下。

编辑结束

我不知道该做什么,设置什么,删除,修改,配置,aaaargh。

我最后的希望是,有人有一个很大的暗示,一个好主意或一个解决方法。

提前致谢。

1 个答案:

答案 0 :(得分:1)

Restbed可以使用Visual Studio 2015/2017构建,为什么不在该平台上使用本机工具链?