I constantly have CLion editor showing me parameter type mismatch errors while during build everything is fine. For example, consider the following MWE:
#include <iostream>
#include <boost/container/flat_set.hpp>
using namespace std;
namespace bc = boost::container;
int main() {
bc::flat_set<bc::flat_set<int>> manySets;
bc::flat_set<int> oneSet({1, 2, 3});
manySets.insert(oneSet);
cout << "Hello, World!" << endl;
return 0;
}
Here flat_set is a template from boost library (description could be seen here). Editor shows me an error:
But when I build it (even from CLion), everything is compiled fine.
My system is:
Ubuntu 15.10 64bit
CLion 1.2.4
This looks like a known problem - https://youtrack.jetbrains.com/issue/CPP-6027. We hope to fix it soon.
Related
I have a weird problem when trying to print out the content of a vector.
I'm using Visual Studio Code with the CMake extension.
I can print out simple text using cout
#include <iostream>
#include <vector>
using namespace std;
int main() {
cout << "test" << endl;
return 0;
}
But I can't print out the vectors content
#include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> test = {1,2,3};
cout << "test" << endl;
cout << test[1] << endl;
return 0;
}
I've never really worked with C++ vectors, so I'm probably missing something fairly obvious but I followed a C++ vector tutorial step by step and for them, the output works fine.
Cheers,
Luca
I'm new to C++ and have exactly the same problem.
Temporary workaround as posted by Luckylone here
would be to copy libstdc++-6.dll from your mingw64\bin folder into your project folder.
Something is messing up our link with the resources even though folders are properly added to system PATH.
EDIT: After an afternoon of troubleshooting, I've solved my problem by uninstalling compilers (originally provided through WinLibs) and reinstalling them using MSYS2.
Delete the existing Mingw64 folder, remove the PATH variables, then carefully follow these instructions. Keep in mind that I had to add mingw64/bin to both user and system Path, and restart VS Code before damn std::vector finally started to print.
Can someone explain what is happening here?
#include <iostream>
#include <string>
using namespace std;
int main() {
string kek = "kek";
cout << "test" << endl;
return 0;
}
For some reason, every time I compile with g++, and I declare a string variable, I can't see any output, no compile or runtime errors, simply no output.
Now, if I change the code to be this instead:
#include <iostream>
#include <string>
using namespace std;
int main() {
// string kek = "kek";
cout << "test" << endl;
return 0;
}
then everything works.
Does anyone know what the problem is here?
I am currently on Windows 10, using gcc 8.1.0.
Edit:
same thing but using bash, linux compile
i think the version of mingw i had is bugged so trying to reinstall it
Okay so still i have no idea what that bug was about,
but when i had it, the version of MinGW i had was 32bit,
changing the MinGW installation to 64bit, fixed that issue.
i have changed nothing, except removing MinGW 32bit from my comp,
and setting the MinGW 64bit.
Swaping from MinGW 32bit to 64bit, fixed the issue.
I made a small c++ project and it was fully compiled and built it.
#include <iostream>
using namespace std;
int main()
{
cout << "Hello world!" << endl;
return 0;
}
When I run through c::b it was okay
However, it says next warnings when I run program outside of the c::b.
"programdir/bin/Debug/program.exe"
So I got "libgcc_s_dw2-1.dll" from sourceforge, pasted it next to my .exe file,
and I got 0xc000007b error with the error "cannot start the program"
What should I do in this case of problem?
I created C++ console project in Eclipse on Windows 7. I wanted it to run in external terminal, so I configured External Tool as described here: LINK. The following code runs fine and shows "Hello" on the console:
#include <iostream>
#include <string>
#include <vector>
#include <queue>
using namespace std;
void foo() {
//queue<char> x;
}
int main() {
//vector<int> a;
//string t;
cout << "Hello World!" << endl;
cin.get();
return 0;
}
However, when I uncomment one of the lines above, external console refuses to work (program exits instantly). Program compiles successfully and runs in the internal console.
The variables do not have to be used, declaration is sufficient to stop excution. I assume, there is something wrong with the External Tool, as the internal console works normally (maybe I should add some libraries to working directory).
Any ideas?
So I was starting my first project using CLion and the boost library, and following the "getting started" guide from the boost webpage, I have written the following program:
#include <boost/lambda/lambda.hpp>
#include <iostream>
int main()
{
using namespace boost::lambda;
using namespace std;
std::for_each(
istream_iterator<int>(std::cin), istream_iterator<int>(), cout <<(_1 * 3) << " " );
}
Now I have cout <<(_1 * 3) << " "underlined as an error in the IDE saying that the binary operator << is not being applied to the correct types. However the program compiles and runs without errors.
It is not a major issue, but it's a bit annoying and I'm quite curious about the cause of it.