News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

New program returns value immediately

Started by MichKat, December 16, 2021, 12:41:23 PM

Previous topic - Next topic

MichKat

Hi,
I have been using codeblock here and there but today after trying to create new file I wasn't even able to build it at first. After reinstalling codeblocks I am able to build new file but after running it I get a non 0 return value and the "Hello World!" isn't printed. If anyone has some idea what might be wrong please say.

SOLUTION EDIT: Renaming the file the project is in seems to have resolved it.

Miguel Gimenez


MichKat

Sorry for not posting original post in correct format. However, after restarting the program after restarting the program I found out that the file obj\Debug\main.o doesn't seem to be created, created few projects with different options but some files are always not there. My antivirus doesn't seem to have prevented files from being created, and even after taking away permission to do so from it, new projects still didn't create those files. Old programs have all those files so I am not sure what is preventing creation of those files nor how to find it out.

Miguel Gimenez

In that case post a full rebuild log, see this for help

gd_on

Look also carefully to your antivirus software. Last week, my antivirus decided that some executables in my compiler directory contained viruses. That was false positives, but of courses my own executables were not created...
IF it's not your first program, I suppose that you know that it's better to create a project and to check the option "Pause when execution ends" : this is a so common error.
Windows 11 64 bits (25H2), svn C::B (last version or almost!), wxWidgets 3.3.2, Msys2 Compilers 16.1.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

MichKat

I hope this is the rebuild log.


-------------- Clean: Debug in soc (compiler: GNU GCC Compiler)---------------

Cleaned "soc - Debug"

-------------- Build: Debug in soc (compiler: GNU GCC Compiler)---------------

g++.exe  -o bin\Debug\soc.exe obj\Debug\main.o   
g++.exe: error: obj\Debug\main.o: No such file or directory
g++.exe: fatal error: no input files
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))
2 error(s), 0 warning(s) (0 minute(s), 0 second(s))



Miguel Gimenez

There is no command for compiling main.cpp.

Go to Project -> Properties -> Build targets and select the Debug target. Then, in the lower right corner (Build target fiiles), look for main.cpp and check it. Close and do a full rebuild again.

MichKat


Miguel Gimenez


MichKat


Miguel Gimenez

Works here:

-------------- Clean: Debug in soc (compiler: GNU GCC Compiler)---------------

Cleaned "soc - Debug"

-------------- Build: Debug in soc (compiler: GNU GCC Compiler)---------------

g++.exe -Wall -fexceptions -g  -c C:\Users\Miguel\Desktop\soc\main.cpp -o obj\Debug\main.o
g++.exe  -o bin\Debug\soc.exe obj\Debug\main.o   
Output file is bin\Debug\soc.exe with size 63.75 KB
Process terminated with status 0 (0 minute(s), 1 second(s))
0 error(s), 0 warning(s) (0 minute(s), 1 second(s))


The only thing I can think of is a bad compiler configuration, go to Settings -> Compiler -> Toolchain executables -> C++ compiler and check it is g++.exe

MichKat

Thanks for help but it is g++.exe for C++, will try to play with antivirus and other software a little more. Thanks for help!