ld.exe找不到-lGL(ld.exe cannot find -lGL)
我最近买了一本关于OpenGL的书,我似乎无法得到它的工作。
例如,它给了我错误:
ld.exe ||找不到-lGL |。
我的编译器是使用IDE
Code::Blocks
GNU-GCC
MinGW
,我的操作系统是Windows 7 64位。 我已经链接了库:opengl32
,glu32
,glut32
和其他链接器选项我有:-lmingw32
-lSDLmain
-lSDL
,因为这是在code::blocks
维基上建议的。我有一些C ++的经验,但是在链接和设置编译器方面没有什么经验,因为它过去常常是自动的。
我如何解决这个错误?
I have recently bought a book on OpenGL, and I can't seem to get it working.
For example, it gives me the error:
ld.exe||cannot find -lGL|.
My compiler is
GNU-GCC
MinGW
on with the IDECode::Blocks
, and my OS is Windows 7 64 bit. I have linked the libraries:opengl32
,glu32
,glut32
, and in other linker options I have:-lmingw32
-lSDLmain
-lSDL
, because this was advised on thecode::blocks
wiki.I have some experience with C++, but not at all when it comes to linking, and setting up the compiler, because this used to go quite automatic.
How do I fix this error?
原文:https://stackoverflow.com/questions/13335703
最满意答案
使用String.Split方法(String [],StringSplitOptions),如下所示:
var lines = source.Split(new [] { "\r\n", "\n" }, StringSplitOptions.None);
无论源是使用Windows linebreak
\r\n
还是Unix\n
编写,这个都可以使用。正如其他答案所提到的,您可以使用
StringSplitOptions.RemoveEmptyEntries
而不是StringSplitOptions.None
,正如名称所示,它删除空字符串(" "
不符合空,只有""
确实如此)。Use String.Split Method (String[], StringSplitOptions) like this:
var lines = source.Split(new [] { "\r\n", "\n" }, StringSplitOptions.None);
This one will work regardless of whether the source is written with Windows linebreak
\r\n
or Unix\n
.As other answers mention, you could use
StringSplitOptions.RemoveEmptyEntries
instead ofStringSplitOptions.None
which, as the name says, removes empty strings (" "
does not qualify for being empty, only""
does).
相关问答
更多-
将带有换行符的文本转换为IntelliJ IDEA中的Java String(Convert text with newlines to Java String in IntelliJ IDEA)[2023-02-15]
这很简单! 只需创建一个这样的代码块: String sql = ""; 定位游标-inside-双引号,然后粘贴sql代码(包含换行符)。 结果将是这样的: String sql = " SELECT\n" + " *\n" + " FROM\n" + " MyTable"; This is reall simple! Just create yourself a code block like this: String sql = ""; ... -
你可以使用replaceAll(模式,替换): main() { var multiline = "hello\nworld"; var singleline = multiline.replaceAll("\n", " "); print(singleline); } You can use replaceAll(pattern, replacement): main() { var multiline = "hello\nworld"; var singleline = multi ...
-
如何将换行文件转换为带有换行符的bash中的字符串?(How to convert multiline file into a string in bash with newline character?)[2022-01-28]
一种使用awk : $ awk '$1=$1' ORS='\\n' file -----BEGIN CERTIFICATE-----\nMIIDBjCCMIIDB\nMIIDBjCCMIIDB\n....\nMIIDBjCCMIIDB==\n-----END CERTIFICATE-----\n One way using awk: $ awk '$1=$1' ORS='\\n' file -----BEGIN CERTIFICATE-----\nMIIDBjCCMIIDB\nMIIDBjCCMIIDB\ ... -
您应该使用str.splitlines()来分割来自文本框的文本,而不是现在使用的任何文本。 该方法正确处理\r\n 。 You should use str.splitlines() to split the text coming from the textbox, instead of whatever it is you're using now. That method handles \r\n properly.
-
使用String.Split方法(String [],StringSplitOptions),如下所示: var lines = source.Split(new [] { "\r\n", "\n" }, StringSplitOptions.None); 无论源是使用Windows linebreak \r\n还是Unix \n编写,这个都可以使用。 正如其他答案所提到的,您可以使用StringSplitOptions.RemoveEmptyEntries而不是StringSplitOptions.No ...
-
在Perl中,如何将所有换行符转换为字符串中的空格?(In Perl, how can I convert all newlines to spaces in a string?)[2022-05-21]
我建议限制使用$a和$b来排序例程。 对于你的问题, tr///比s///更合适: #!/usr/bin/perl use strict; use warnings; my $x = q{dflsdgjsdg dsfsd gf sgd g sdg sdf gsd}; $x =~ tr{\n}{ }; print $x, "\n"; __END__ 输出: C:\Temp> ttt dflsdgjsdg dsfsd gf sgd g sdg sdf gsd 更新:我不认为TMTOWTDI在这里使用 ... -
包含电池 - defaultdict处理自动保存新密钥的值作为列表,我们利用str的iswhitespace方法来检查缩进(否则我们可以使用正则表达式): from collections import defaultdict data = """ Key 1 Value 1 Key 2 Value 2 Key 3 Value 3a Value 3b Value 3c Key 4 Value 4a Value 4b """ result ...
-
将换行符分隔的字符串拆分为三个变量,#newlines unknown(Split newline-delimited string into three variables, # newlines unknown)[2022-11-18]
您可以跳过临时变量并直接分配: my ($var0, $var1, $var2, $var3) = split /\n/, $string; 如果您的分隔字符串中缺少字段,则缺少的变量将是未定义的。 这与您使用数组的行为相同。 定义何时缺少字段的方法是,它将是未定义的: if (defined $var1) { # field exists 您还可以计算字段,如果使用数组,这将更容易 my @fields = split /\n/, $string; my $count ... -
看到这个方向: 1. System.getProperty("line.separator"); 2. System.lineSeparator(); 例如: pw.print(txt.replace("\n", System.lineSeparator()).replace("\r\n", System.lineSeparator())); See in this direction: 1. System.getProperty("line.separator"); 2. System.lin ...
-
您可以先用\n (换行符和空格)替换所有\n ,然后对空格字符进行简单拆分。 String input = "Hello \n\n\nworld!"; String replacement = input.replace("\n", "\n "); String[] result = replacement.split(" "); 输入: "Hello \n\n\nworld!" 替换: "Hello \n \n \n world!" 结果: ["Hello", "\n", "\n ...