我需要帮助尝试使用 MinGW 编译 GLFW 的简单示例

2024-04-12

我正在尝试从 GLFW 的文档中编译一个示例。

我的库和源文件的文件夹结构是:

C:\cpp\

glfw3.dll glfw3dll.a libglfw3.a test.cpp

include\

GLFW\

glfw3.h glfw3native.h

#include <GLFW/glfw3.h>

int main(void)
{
    GLFWwindow* window;

    /* Initialize the library */
    if (!glfwInit())
        return -1;

    /* Create a windowed mode window and its OpenGL context */
    window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
    if (!window)
    {
        glfwTerminate();
        return -1;
    }

    /* Make the window's context current */
    glfwMakeContextCurrent(window);

    /* Loop until the user closes the window */
    while (!glfwWindowShouldClose(window))
    {
        /* Render here */

        /* Swap front and back buffers */
        glfwSwapBuffers(window);

        /* Poll for and process events */
        glfwPollEvents();
    }

    glfwTerminate();
    return 0;
}

我正在尝试用这个命令编译它

c:\cpp>x86_64-w64-mingw32-g++ -lglfw3  -Iinclude test.cpp -o test

但我收到此错误:

c:/users/username/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lglfw3 collect2.exe: error: ld returned 1 exit status

-v 输出:

Using built-in specs.
COLLECT_GCC=x86_64-w64-mingw32-g++
COLLECT_LTO_WRAPPER=c:/users/username/gcc/bin/../libexec/gcc/x86_64-w64-ming
w32/4.7.2/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-4.7.2-mingw/configure --host=x86_64-w64-mingw32 --build=
x86_64-unknown-linux-gnu --target=x86_64-w64-mingw32 --prefix=/home/gfortran/gcc
-home/binary/mingw32/native/x86_64/gcc/4.7.2 --with-sysroot=/home/gfortran/gcc-h
ome/binary/mingw32/cross/x86_64/gcc/4.7.2 --with-gcc --with-gnu-ld --with-gnu-as
 --with-gmp=/home/gfortran/gcc-home/binary/mingw32/native/x86_64/gmp --with-mpfr
=/home/gfortran/gcc-home/binary/mingw32/native/x86_64/mpfr --with-mpc=/home/gfor
tran/gcc-home/binary/mingw32/native/x86_64/mpc --with-cloog=/home/gfortran/gcc-h
ome/binary/mingw32/native/x86_64/cloog --with-ppl=/home/gfortran/gcc-home/binary
/mingw32/native/x86_64/ppl --with-host-libstdcxx='-lstdc++ -lsupc++ -lm' --enabl
e-cloog-backend=ppl --enable-targets=i686-w64-mingw32,x86_64-w64-mingw32 --enabl
e-lto --enable-languages=c,c++,fortran --enable-libgomp --enable-threads=win32 -
-enable-static --enable-shared=lto-plugin --enable-plugins --enable-ld=yes --ena
ble-libquadmath --enable-libquadmath-support --disable-nls --disable-tls --disab
le-win32-registry
Thread model: win32
gcc version 4.7.2 (GCC)
COLLECT_GCC_OPTIONS='-I' 'include' '-o' 'test.exe' '-v' '-mtune=generic' '-march
=x86-64'
 c:/users/username/gcc/bin/../libexec/gcc/x86_64-w64-mingw32/4.7.2/cc1plus.e
xe -quiet -v -I include -iprefix c:\users\username\gcc\bin\../lib/gcc/x86_64
-w64-mingw32/4.7.2/ -U_REENTRANT test.cpp -quiet -dumpbase test.cpp -mtune=gener
ic -march=x86-64 -auxbase test -version -o C:\Users\username~1.ADM\AppData\Local\T
emp\ccfe85gV.s
GNU C++ (GCC) version 4.7.2 (x86_64-w64-mingw32)
        compiled by GNU C version 4.7.2, GMP version 5.0.5, MPFR version 3.0.0,
MPC version 0.9
warning: GMP header version 5.0.5 differs from library version 5.0.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "c:/users/username/gcc/lib/gcc/../../lib/gcc/x8
6_64-w64-mingw32/4.7.2/../../../../include/c++/4.7.2"
ignoring duplicate directory "c:/users/username/gcc/lib/gcc/../../lib/gcc/x8
6_64-w64-mingw32/4.7.2/../../../../include/c++/4.7.2/x86_64-w64-mingw32"
ignoring duplicate directory "c:/users/username/gcc/lib/gcc/../../lib/gcc/x8
6_64-w64-mingw32/4.7.2/../../../../include/c++/4.7.2/backward"
ignoring duplicate directory "c:/users/username/gcc/lib/gcc/../../lib/gcc/x8
6_64-w64-mingw32/4.7.2/include"
ignoring nonexistent directory "/home/gfortran/gcc-home/binary/mingw32/cross/x86
_64/gcc/4.7.2/home/gfortran/gcc-home/binary/mingw32/native/x86_64/gcc/4.7.2/lib/
gcc/x86_64-w64-mingw32/4.7.2/../../../../include"
ignoring duplicate directory "c:/users/username/gcc/lib/gcc/../../lib/gcc/x8
6_64-w64-mingw32/4.7.2/include-fixed"
ignoring duplicate directory "c:/users/username/gcc/lib/gcc/../../lib/gcc/x8
6_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/include"
ignoring nonexistent directory "/home/gfortran/gcc-home/binary/mingw32/cross/x86
_64/gcc/4.7.2/mingw/include"
#include "..." search starts here:
#include <...> search starts here:
 include
 c:\users\username\gcc\bin\../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../i
nclude/c++/4.7.2
 c:\users\username\gcc\bin\../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../i
nclude/c++/4.7.2/x86_64-w64-mingw32
 c:\users\username\gcc\bin\../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../i
nclude/c++/4.7.2/backward
 c:\users\username\gcc\bin\../lib/gcc/x86_64-w64-mingw32/4.7.2/include
 c:\users\username\gcc\bin\../lib/gcc/x86_64-w64-mingw32/4.7.2/include-fixed

 c:\users\username\gcc\bin\../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x
86_64-w64-mingw32/include
End of search list.
GNU C++ (GCC) version 4.7.2 (x86_64-w64-mingw32)
        compiled by GNU C version 4.7.2, GMP version 5.0.5, MPFR version 3.0.0,
MPC version 0.9
warning: GMP header version 5.0.5 differs from library version 5.0.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 0b3cd9e378660c38a8a80567400ff92f
COLLECT_GCC_OPTIONS='-I' 'include' '-o' 'test.exe' '-v' '-mtune=generic' '-march
=x86-64'
 c:/users/username/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x
86_64-w64-mingw32/bin/as.exe -v -I include -o C:\Users\username~1.ADM\AppData\Loca
l\Temp\ccQqklHV.o C:\Users\username~1.ADM\AppData\Local\Temp\ccfe85gV.s
GNU assembler version 2.22.52 (x86_64-w64-mingw32) using BFD version (GNU Binuti
ls) 2.22.52.20120723
COMPILER_PATH=c:/users/username/gcc/bin/../libexec/gcc/x86_64-w64-mingw32/4.
7.2/;c:/users/username/gcc/bin/../libexec/gcc/;c:/users/username/gcc/bin
/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/
EQ_LIBRARY_PATH=c:/users/username/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.
2/;c:/users/username/gcc/bin/../lib/gcc/;C:/Users/username/gcc/x86_64-w6
4-mingw32/lib/../lib/;c:/users/username/gcc/bin/../lib/gcc/x86_64-w64-mingw3
2/4.7.2/../../../../x86_64-w64-mingw32/lib/../lib/;c:/users/username/gcc/bin
/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../lib/;C:/Users/username/gcc/
x86_64-w64-mingw32/lib/;c:/users/username/gcc/bin/../lib/gcc/x86_64-w64-ming
w32/4.7.2/../../../../x86_64-w64-mingw32/lib/;c:/users/username/gcc/bin/../l
ib/gcc/x86_64-w64-mingw32/4.7.2/../../../
COLLECT_GCC_OPTIONS='-I' 'include' '-o' 'test.exe' '-v' '-mtune=generic' '-march
=x86-64'
 c:/users/username/gcc/bin/../libexec/gcc/x86_64-w64-mingw32/4.7.2/collect2.
exe --sysroot=/home/gfortran/gcc-home/binary/mingw32/cross/x86_64/gcc/4.7.2 -m i
386pep -Bdynamic -o test.exe C:/Users/username/gcc/x86_64-w64-mingw32/lib/..
/lib/crt2.o C:/Users/username/gcc/x86_64-w64-mingw32/lib/../lib/crtbegin.o -
Lc:/users/username/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2 -Lc:/users/
username/gcc/bin/../lib/gcc -LC:/Users/username/gcc/x86_64-w64-mingw32/lib
/../lib -Lc:/users/username/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../.
./../../x86_64-w64-mingw32/lib/../lib -Lc:/users/username/gcc/bin/../lib/gcc
/x86_64-w64-mingw32/4.7.2/../../../../lib -LC:/Users/username/gcc/x86_64-w64
-mingw32/lib -Lc:/users/username/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2
/../../../../x86_64-w64-mingw32/lib -Lc:/users/username/gcc/bin/../lib/gcc/x
86_64-w64-mingw32/4.7.2/../../.. C:\Users\username~1.ADM\AppData\Local\Temp\ccQqkl
HV.o -lglfw3 -lstdc++ -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -ladvapi32 -
lshell32 -luser32 -lkernel32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt C:/Us
ers/username/gcc/x86_64-w64-mingw32/lib/../lib/crtend.o
c:/users/username/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x8
6_64-w64-mingw32/bin/ld.exe: skipping incompatible c:/users/username/gcc/bin
/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../lib/libglfw3.a when searching f
or -lglfw3
c:/users/username/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x8
6_64-w64-mingw32/bin/ld.exe: skipping incompatible c:/users/username/gcc/bin
/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../lib/glfw3.dll when searching fo
r -lglfw3
c:/users/username/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x8
6_64-w64-mingw32/bin/ld.exe: skipping incompatible c:/users/username/gcc/bin
/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../lib\libglfw3.a when searching f
or -lglfw3
c:/users/username/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x8
6_64-w64-mingw32/bin/ld.exe: skipping incompatible c:/users/username/gcc/bin
/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../libglfw3.a when searching for -lgl
fw3
c:/users/username/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x8
6_64-w64-mingw32/bin/ld.exe: skipping incompatible c:/users/username/gcc/bin
/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../glfw3.dll when searching for -lglf
w3
c:/users/username/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x8
6_64-w64-mingw32/bin/ld.exe: skipping incompatible c:/users/username/gcc/bin
/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../..\libglfw3.a when searching for -lgl
fw3
c:/users/username/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x8
6_64-w64-mingw32/bin/ld.exe: skipping incompatible c:/users/username/gcc/bin
/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../lib/libglfw3.a when searching f
or -lglfw3
c:/users/username/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x8
6_64-w64-mingw32/bin/ld.exe: skipping incompatible c:/users/username/gcc/bin
/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../lib/glfw3.dll when searching fo
r -lglfw3
c:/users/username/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x8
6_64-w64-mingw32/bin/ld.exe: skipping incompatible c:/users/username/gcc/bin
/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../libglfw3.a when searching for -lgl
fw3
c:/users/username/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x8
6_64-w64-mingw32/bin/ld.exe: skipping incompatible c:/users/username/gcc/bin
/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../glfw3.dll when searching for -lglf
w3
c:/users/username/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x8
6_64-w64-mingw32/bin/ld.exe: cannot find -lglfw3
collect2.exe: error: ld returned 1 exit status

c:\cpp>x86_64-w64-mingw32-g++ -Iinclude test.cpp -o test .\glfw3.dll

c:/users/username/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x8
6_64-w64-mingw32/bin/ld.exe: i386 architecture of input file `.\glfw3.dll' is in
compatible with i386:x86-64 output
C:\Users\username~1.ADM\AppData\Local\Temp\cceVroaP.o:test.cpp:(.text+0xe): undefi
ned reference to `glfwInit'
C:\Users\username~1.ADM\AppData\Local\Temp\cceVroaP.o:test.cpp:(.text+0x43): undef
ined reference to `glfwCreateWindow'
C:\Users\username~1.ADM\AppData\Local\Temp\cceVroaP.o:test.cpp:(.text+0x53): undef
ined reference to `glfwTerminate'
C:\Users\username~1.ADM\AppData\Local\Temp\cceVroaP.o:test.cpp:(.text+0x66): undef
ined reference to `glfwMakeContextCurrent'
C:\Users\username~1.ADM\AppData\Local\Temp\cceVroaP.o:test.cpp:(.text+0x74): undef
ined reference to `glfwSwapBuffers'
C:\Users\username~1.ADM\AppData\Local\Temp\cceVroaP.o:test.cpp:(.text+0x79): undef
ined reference to `glfwPollEvents'
C:\Users\username~1.ADM\AppData\Local\Temp\cceVroaP.o:test.cpp:(.text+0x85): undef
ined reference to `glfwWindowShouldClose'
C:\Users\username~1.ADM\AppData\Local\Temp\cceVroaP.o:test.cpp:(.text+0x93): undef
ined reference to `glfwTerminate'
c:/users/username/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x8
6_64-w64-mingw32/bin/ld.exe: C:\Users\username~1.ADM\AppData\Local\Temp\cceVroaP.o
: bad reloc address 0x0 in section `.pdata'
c:/users/username/gcc/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x8
6_64-w64-mingw32/bin/ld.exe: final link failed: Invalid operation
collect2.exe: error: ld returned 1 exit status

库在命令行中出现的顺序对于 gcc 以及要查找的库搜索路径很重要。尝试移动-lglfw3到最后并将当前目录添加到搜索路径中使用-L.

eg.

g++ -Iinclude test.cpp -o test.exe -L . -lglfw3

Edit1:从详细的状态输出来看,似乎libglfw3.a您所拥有的与您正在使用的 mingw gcc 不兼容。幸运的是,ld链接器可以直接使用dll文件。看看以下是否有效:

g++ -Iinclude test.cpp -o test.exe .\glfw3.dll

另一种方法是创建一个导入库glfw3.dll使用你拥有的 mingw gcc 。这有点复杂,因为您需要创建一个.def文件后调用 dlltool。

Edit2:您使用的 mingw gcc 是 64 位 Windows 编译器。确保您使用正确的 glfw3 64 位库并且not32 位版本。GLFW 下载部分 http://www.glfw.org/download.html.

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

我需要帮助尝试使用 MinGW 编译 GLFW 的简单示例 的相关文章

  • 有没有快速创建集合的方法?

    目前我正在创建一个像这样的新集 std set a s s insert a1 s insert a2 s insert a3 s insert a10 有没有办法创建s在一行 int myints 10 20 30 40 50 std s
  • 我如何理解这个 C 类型声明?

    double bar int double double double double 在查看讲座幻灯片时 我发现了留给学生的练习 用简单的英语来说 什么是类型bar在这个 C 声明中 Please帮助我解决这个问题 我什至不知道从哪里开始
  • FileStream 构造函数和默认缓冲区大小

    我们有一个使用 NET 4 用 C 编写的日志记录类 我想添加一个构造函数参数 该参数可以选择设置文件选项 WriteThrough http msdn microsoft com en us library system io fileo
  • 更改 Qt OpenGL 窗口示例以使用 OpenGL 3.3

    我正在尝试更改 Qt OpenGL 示例以使用更现代的 opengl 版本 330 似乎合适 所以我做了 在 main cpp 上设置版本和配置文件 设置着色器版本 更改着色器以使用统一 它现在构建没有任何错误 但我只看到一个空白窗口 我错
  • 如何在 C# / .NET 中创建内存泄漏[重复]

    这个问题在这里已经有答案了 可能的重复 托管代码中是否可能存在内存泄漏 特别是 C 3 0 https stackoverflow com questions 6436620 is it possible to have a memory
  • 防止 boost::asio::io_context 在空轮询调用时停止

    此代码调用发布的句柄 boost asio io context ioc boost asio post ioc std cout lt lt lol lt lt std endl ioc poll 而这并没有 boost asio io
  • vs2008 c#:Facebook.rest.api如何使用它来获取好友列表?

    如何在此基础上取得进一步的进步 获取好友列表的下一步是什么 string APIKey ConfigurationManager AppSettings API Key string APISecret ConfigurationManag
  • 单例模式和 std::unique_ptr

    std unique ptr唯一地控制它指向的对象 因此不使用引用计数 单例确保利用引用计数只能创建一个对象 那么会std unique ptr与单例执行相同 单例确保只有一个实例属于一种类型 A unique ptr确保只有一个智能指针到
  • 从 WebBrowser 控件 C# 获取滚动值

    我试图在 WebBrowser 控件中获取网页的 Y 滚动索引 但无法访问内置滚动条的值 有任何想法吗 对于标准模式下的 IE 使用文档类型 正如你所说 scrollTop是的财产元素 而不是 HtmlDocument htmlDoc th
  • C++ php 和静态库

    我创建了一个library a 其中包含 cpp 和 h 文件 其中包含很多类 嵌套类和方法 我想在 php 示例中包含这个静态库并尝试使用它 我想提一下 我是 php 新手 我已经在 test cpp 文件中测试了我的 libray a
  • 检查 RoutedEvent 是否有任何处理程序

    我有一个自定义 Button 类 当单击它时 打开特定窗口 它总是执行相同的操作 我添加了一个可以在按钮的 XAML 中分配的 Click 事件 就像常规按钮一样 当它被单击时 我想执行 Click 事件处理程序 如果已分配 否则我想执行默
  • 如何在子 shell 中运行 cmd.exe 批处理文件

    我有一个批处理文件 通常像这样调用 longjob cmd gt result txt 2 gt 1 这工作正常 但脚本在执行过程中更改了目录 将我的 shell 留在该目录中 这很麻烦 有没有办法在子 shell 中运行命令 同时仍然允许
  • cout 和字符串连接

    我刚刚复习了我的 C 我尝试这样做 include
  • 了解使用 Windows 本机 WPF 客户端进行 ADFS 登录

    我已经阅读了大量有关 ADFS 与 NodeJS Angular 或其他前端 Web 框架集成以及一般流程如何工作的文献 并通过 Auth0 Angular 起始代码构建了概念证明 但我不明白如何这可以与本机 WPF Windows 应用程
  • Pip 无法在 Windows 上安装 Twisted

    我正在尝试在 Windows 8 计算机上安装 Twisted 在 Twisted 官方网站上 只有一个 Windows 版的 Wheel 文件 https twistedmatrix com trac wiki Downloads htt
  • 如何获取Windows批处理的父文件夹

    我正在编写一个批处理文件 我需要获取该bat文件的父文件夹 有可能吗 注意 我的意思是批处理文件的父文件夹 而不是调用该批处理的提示的当前目录 Thanks 批处理的父文件夹位于变量中 dp0位于 例子 echo off setlocal
  • 矩阵到数组 C#

    这将是转换方阵的最有效方法 例如 1 2 3 4 5 6 7 8 9 into 1 2 3 4 5 6 7 8 9 in c 我在做 int array2D new int 1 2 3 4 5 6 7 8 9 int array1D new
  • 将 char[][] 转换为 char** 会导致段错误吗?

    好吧 我的 C 有点生疏了 但我想我应该用 C 来做我的下一个 小 项目 这样我就可以对其进行抛光 并且我已经有不到 20 行的段错误了 这是我的完整代码 define ROWS 4 define COLS 4 char main map
  • xsi:type 属性搞乱了 C# XML 反序列化

    我使用 XSD exe 根据 XML 架构 xsd 文件 自动生成 C 对象 我正在反序列化 OpenCover 输出 但其中一个部分类未正确生成 这是导致异常的行
  • Java 和/C++ 在多线程方面的差异

    我读过一些提示 多线程实现很大程度上取决于您正在使用的目标操作系统 操作系统最终提供了多线程能力 比如Linux有POSIX标准实现 而windows32有另一种方式 但我想知道编程语言水平的主要不同 C似乎为同步提供了更多选择 例如互斥锁

随机推荐

  • 设置特定文件的 AWS S3 过期时间

    我阅读了 PHP AWS SDK 文档 https docs aws amazon com aws sdk php v2 api class Aws S3 S3Client html https docs aws amazon com aw
  • 二分布局Gephi 0.9.1

    我的问题简单得令人尴尬 how do i plot a bipartite graph in Gephi with a layout like the one you see in the attached image 我真的无法在Geph
  • 是否可以通过显式类型转换将基类对象分配给派生类引用?

    是否可以在 C 中使用显式类型转换将基类对象分配给派生类引用 我已经尝试过了 它会产生运行时错误 不可以 对派生类的引用实际上必须引用派生类的实例 或 null 否则你会期望它如何表现 例如 object o new object stri
  • Jetty 返回 403 Forbidden

    您好 我正在将我的网络应用程序从 tomcat 移植到 Jetty 我正在使用 Jetty runner 来启动它 我使用以下命令来启动 Jetty java jar jetty runner jar port path url path
  • psql 显示 ansi 彩色文本

    My psqlrc有以下选项 setenv LESS iMSx4 FXR setenv PAGER less pset pager always 我想要着色的 psql 输出是 x1B 35m x1B 0m x1B 35mr x1B 0m
  • 检测Python字符串是数字还是字母[重复]

    这个问题在这里已经有答案了 如何检测字符串中的数字或字母 我知道您使用 ASCII 代码 但是哪些函数利用了它们呢 检查字符串是否为非负的数字 整数 和字母 您可以使用str isdigit https docs python org 2
  • 使用 async/await 锁定资源

    我有一个应用程序 其中有一个可由多个客户端访问的共享资源 运动系统 我有一些单独的操作 需要在移动期间访问系统 并且如果同时请求冲突的操作 则应抛出 繁忙 异常 我还有序列器 它们需要获得对运动系统的独占访问权限 以执行多个操作 并穿插其他
  • Objective-C 类别性能

    如果我使用类别将 Objective C 类的实现分解为多个 implementation块 这会使我的 iOS 应用程序生成的二进制文件更大或根本影响性能吗 显然 你不能在运行时获取类的类别详细信息 https stackoverflow
  • 为什么从 App.xaml 设置样式 TargetType="Window" 不起作用?

    我正在 VS2013 中创建一个简单的 WPF 项目 我想将属性应用到我的主窗口 我将它们设置在我的App xaml像这样的文件
  • “入队”和“出队”之间的区别

    有人可以解释一下主要区别吗 我对任何语言编程中的这些函数都没有明确的了解 C 和 C 等编程语言中的一些基本数据结构是堆栈和队列 堆栈数据结构遵循 先进后出 策略 FILO 其中插入或 推入 堆栈的第一个元素是最后一个从堆栈中删除或 弹出
  • 使用 jquery ajax 的两个 CORS 请求之间的时间间隔

    我正在使用 jQuery 向 Web 服务发出 CORS 请求 ajax 根据标准 有一个飞行前请求 然后是实际的 POST 请求 我注意到 每次我尝试进行 Web 服务调用时 都会有两个请求 一个是飞行前请求 一个是实际的 POST 请求
  • ASP.NET - 将 JSON 从 jQuery 传递到 ASHX

    我正在尝试将 JSON 从 jQuery 传递到 ASHX 文件 下面的 jQuery 示例 ajax type POST url test ashx data file dave type ward contentType applica
  • SQL Regex 函数类似于 MySql REGEX 函数

    我正在寻找一个能够执行与 TSQL 的 MySQL REGEX 函数相同的操作的函数 基本上我需要我的查询如下所示 SELECT FROM Routing WHERE Message REGEX RouteRegex 我现在不太热衷于使用
  • C++处理文件文件末尾的空行

    当我使用c 处理文件时 我发现文件末尾总是有一个空行 有人说vim会在文件末尾追加一个 n 但是当我使用gedit时 它也有同样的问题 谁能告诉我原因吗 1 include
  • GCC 4.7.2:带有指向成员函数指针的 std::thread

    在编写测试代码时这个问题 https stackoverflow com questions 15080015 stdthread with pointer to data member我发现下面的注释行无法在 GCC 4 7 2 上编译
  • 为什么Hadoop文件系统不支持随机I/O?

    分布式文件系统 例如 Google 文件系统和 Hadoop 不支持随机 I O 不能修改之前写入的文件 只能写入和追加 他们为什么要这样设计文件系统 该设计有哪些重要优点 P S 我知道 Hadoop 将支持修改写入的数据 但他们表示 它
  • 简单的面试问题变得更难:给定数字 1..100,在给定 k 个缺失的情况下找到缺失的数字

    不久前我有过一次有趣的求职面试经历 这个问题一开始很简单 Q1 我们有一个装有数字的袋子1 2 3 100 每个数字只出现一次 所以有 100 个数字 现在从袋子里随机选出一个号码 找到丢失的号码 当然 我以前听说过这个面试问题 所以我很快
  • Clojure 中使用 clj-http 进行基本身份验证

    我们正在使用clj http https github com dakrone clj http进行 HTTP 基本身份验证 我想发送带有此标头的请求 Authorization Basic dXNlcm5hbWU6cGFzc3dvcmQ
  • 使用 Java RealTime 的生产者-消费者架构

    我正在使用 Java Realtime Sun JRTS 2 2 设计交易系统 并且想问一些有关最佳实践的问题 因为我担心发明轮子 并且非常确定我的任务已经解决了 所以我有一个线程不断读取套接字 解析字节并提取消息 二进制协议 之后 我应该
  • 我需要帮助尝试使用 MinGW 编译 GLFW 的简单示例

    我正在尝试从 GLFW 的文档中编译一个示例 我的库和源文件的文件夹结构是 C cpp glfw3 dll glfw3dll a libglfw3 a test cpp include GLFW glfw3 h glfw3native h