Wednesday, January 5, 2022

[SOLVED] CodeBlocks giving "An assertion failed!" error when attempting to compile or create new file

Issue

I'm trying out Code::Blocks for the first time on my computer running Fedora 29 (everything updated to the latest in the repositories, official + RPM Fusion), but upon creating a new file or saving changes to the one I have in the project I've made (which was successfully created), I get the following error: "../src/common/strconv.cpp(3018): assert "Assert failure" failed in wxCSConv(): invalid encoding value in wxCSConv ctor". I am still able to build and run the project, works just fine.

My sole file in the project is main.cpp, consisting of a basic "Hello World" program.

#include <cstdio>

int main() {
    printf("hi");

    return 0;
}

As this error also happened as I was creating the file, I do not think that my code should be the issue. Do note that the file was created successfully regardless, as I could press "Continue" on the error prompt (which I did).

I have attempted to look the issue up online without much success.


Solution

I am also on Fedora 29 with code blocks. Faced with similar issues, tried searching and saw your question. I wouldn't really say I know the solution but i get around this issue by creating a new file through;

  1. Select file menu
  2. select new
  3. select file (NB: not empty file)
  4. Select empty file
  5. click next
  6. leave both debug and release uncheck
  7. click finish after you insert filename/filepath

NB: I am just an amateur, and i wouldn't really say this is a fix but that is how i get around that error.



Answered By - kaneki