我正在尝试使用libsodium制作一个测试应用程序,但是我收到错误:
main.cpp:6: undefined reference to `sodium_init'
Run Code Online (Sandbox Code Playgroud)
我运行以下命令以root用户身份安装。
$ ./configure
$ make && make check
$ make install
Run Code Online (Sandbox Code Playgroud)
这是有问题的代码。
#include <stdio.h>
#include <sodium.h>
int main(int argc, char **argv)
{
if (sodium_init() == -1)
{
return 1;
}
printf("libsodium had no issues!\n");
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我使用CodeLite作为我的 IDE,我的 C++ 编译器选项如下:
-g;-O0;-Wall;-lsodium
Run Code Online (Sandbox Code Playgroud)
这些选项是默认的,我添加-lsodium到列表中。
尝试main.cpp使用以下命令直接从终端编译g++ -lsodium main.cpp会引发相同的错误。
有人可以帮我解决我的问题。
我有一个使用CodeLite在Windows 8.1上使用MinGW32成功构建的项目。我正在尝试将编译器从MinGW32更改为clang。但是,切换编译器后,出现以下错误:
c:/MinGW/lib/gcc/mingw32/4.8.1/include/c++\bits/stringfwd.h:74:33: error: use of undeclared identifier 'char16_t'
Run Code Online (Sandbox Code Playgroud)
...之后还有许多其他类似的性质 因此,我尝试制作一个更简单的程序来检查该程序是否仅在我的代码中,并且对MinGW32感到“幸运”。
以下程序也表现出相同的错误:
#include <iostream>
int main(int argc, char **argv)
{
std::cout << "Hello World" << std::endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
在CodeLite中,设置了以下编译器选项(在编译器之间未更改):
-g;-O0;-Wall;-std=c++11
Run Code Online (Sandbox Code Playgroud)
Enable C++11 Standard (clang)为了确保安全,我也尝试在工作区级别选中该复选框。
在互联网上搜索后,我发现了以下问题:
结果,我尝试添加-fno-ms-compatibility到编译器选项中。由于编译器错误更改为:
c:/MinGW/lib/gcc/mingw32/4.8.1/include/c++\bits/char_traits.h:391:7: error: cannot mangle this built-in char16_t type yet
我也尝试使用流行的搜索引擎来找到解决方案,但我所能找到的只是在名为MicrosoftMangle.cpp的文件中对它的引用。这是提到我遇到的错误的部分:
void MicrosoftCXXNameMangler::mangleType(const BuiltinType *T,
SourceRange Range) {
// <type> ::= <builtin-type>
// <builtin-type> ::= X # void
// ::= C # signed char
// ::= D # …Run Code Online (Sandbox Code Playgroud) #include <iostream>
#include <fstream>
#include <stdlib.h>
#include <process.h>
using namespace std;
int main(){
system("cls");
char mline[75];
int lc=0;
ofstream fout("out.txt",ios::out);
ifstream fin("data.txt",ios::in);
if(!fin){
cerr<<"Failed to open file !";
exit(1);
}
while(1){
fin.getline(mline,75,'.');
if(fin.eof()){break;}
lc++;
fout<<lc<<". "<<mline<<"\n";
}
fin.close();
fout.close();
cout<<"Output "<<lc<<" records"<<endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
上面的代码应该从文件“data.txt”中读取以下文本
“ ifstream 类型流的默认行为(在打开文件时)允许用户从文件中读取内容。如果文件模式是 ios::in 则仅对文本文件执行读取,如果文件模式还包括 ios:: binary 和 ios::in 然后,读取是在二进制模式下执行的。在二进制模式下不会发生字符转换,而在文本模式下会发生特定的转换。”
并创建一个文件 out.txt ,其中使用行号存储相同的文本(一行可以有 75 个字符或以 '.' 结尾 - 以较早者为准)。
每当我运行该程序时,它就会卡在控制台上 - 按下任何键都不会响应。
有人能告诉我这里发生了什么吗?
我正在做一个项目,其中有几个人通过 Git 处理相同的代码。
我只是想知道在这个项目上工作的每个人是否应该共享同一个工作区(通过./foo.workspace文件),或者只是共享项目(通过./foo/foo.project文件)。
我在Ubuntu QQ上使用CodeLite 5.1.默认情况下,基于之前使用QQ和其他工具安装的内容,我有gtCC和gt ++工具链可用.我总是使用gt ++,这似乎与Boost相处得很好.
想要使用C++ 11运行 - 我需要采取哪些步骤?我需要安装C++ 11库吗?
所以我刚刚在Ubuntu trusty(14.04)x64上安装了codelite
一切似乎工作正常,但当我尝试运行调试器时,我在问题标题中得到错误,它只是停在那里,什么都不做.我搜索得很远,无法找到解决这个问题的方法.
我确实看到了这篇文章,但它与windows而不是Linux有关.
我尝试过以下方法:
apt-get install gdb
apt-get install codelite-dbg
ls /usr/bin/ | grep gdb
gdb
gdbtui
gdbus
gdbus-codegen
chmod ug+s /usr/bin/gdb
ls -l /usr/bin/ | grep gdb
-rwsr-sr-x 1 root root 5720256 Oct 30 14:47 gdb
-rwxr-xr-x 1 root root 126 Oct 30 14:47 gdbtui
-rwxr-xr-x 1 root root 35688 Apr 3 2014 gdbus
Run Code Online (Sandbox Code Playgroud)
仍然得到错误,不知道该怎么做.该文件显然存在并且可由所有人执行.
嗨,我目前在我的 IDE 中使用 CodeLite,但我似乎找不到恢复菜单栏的方法。最初我只是想通过点击添加其他栏,但我最终取消选中菜单栏,现在它完全隐藏了。 隐藏的菜单栏图像
我有一个非常具体的问题,但我对 C++ 还比较陌生。你能解释一下命令的每个部分吗?
如果可以的话,还请解释一下在 CodeLite 中将这些选项粘贴到哪里
