“No such file or directory” error in CodeBlocks

Got it finally: In my case, the problem resulted from a program called EGCS (Experimental/Enhanced GNU Compiler System). I installed it as a prerequisite for PSCAD(Power Systems CAD) along with a FORTRAN Compiler. Just remove it, and you’ll be fine.(Sadly, I deleted the entire PATH environmental variable due to a mistake. So what?…I ended up … Read more

Simple C program to read a file line by line

In C you have character oriented input functions (e.g. getchar, fgetc), you have formatted input functions (e.g. the scanf family) and then you have line oriented input functions. (e.g. fgets and POSIX getline). When you are reading lines of data, line oriented input functions are the proper tool for the job. (taking user input with scanf has many pitfalls that new (and even not so new) C programmers fall into) All line oriented functions read … Read more

Why am I getting “undefined reference to main”

Your compiler’s command line contains -I -c sequence. This -I option “swallows” your -c option. -I requires an additional argument, which is an include directory name. You failed to supply that argument, which is why -I assumes that -c that follows it is the directory name. So that -I consumes that -c. The compiler never sees that -c. Without -c it assumes that you want to compile and link your program. Since Gladius.cpp does not have main in it, … Read more

undefined reference to WinMain@16 (codeblocks)

When there’s no project, Code::Blocks only compiles and links the current file. That file, from your picture, is secrypt.cpp, which does not have a main function. In order to compile and link both source files, you’ll need to do it manually or add them to the same project. Contrary to what others are saying, using a … Read more