Author Topic: How to buid and run a program  (Read 2599 times)

Faradaysfinest

  • Guest
How to buid and run a program
« on: October 27, 2022, 11:09:21 pm »
Good evening/ morning to the gentlemen and ladies in the forum. I am quite new to this and I hope my post adheres to the group rules.
I am relatively a newbie to using code::blocks to write programs and execute them. I did C programming in university (graduated in 2008) but to a very basic level. I have recently decided to pick up programming , now in C++ cause I intend to grow my skill and build applications. To this end I will be writing a program or two a day for the next 90 days to see how far I will go from there.

My first program of today is as follows:

#include <iostream.h>
#include <conio.h>

int main()
{
    clrscr();
    int value1, value2, sum;
    cout<<"Enter first value:";
    cin>>value1;
    cout<<"Enter the second value:"
    cin>>value2;
    sum = value1 + value2;
    cout <<"\n";
    cout << "The sum of the given values is: ";
    cout << sum;
    return 0;
}

just a simple program to add two numbers so really it shouldnt be a problem. However, something is amiss with my code::blocks because I am not being able to compile or run it and I suspect that I need some help setting up the code::blocks compiler. I am getting the following error message

Build file: " no target" in "no poject" (compiler: unknown)
fatal error: iostream.h: No such file or directory
Build failed: 1 error(s), ) warnings(s)


May someone advise me how to configure the compiler and also how to import a singular file into a project. Thank you

Regards,
Faradaysfinest

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: How to buid and run a program
« Reply #1 on: October 28, 2022, 12:55:31 am »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: How to buid and run a program
« Reply #2 on: November 14, 2022, 11:57:14 pm »
https://wiki.codeblocks.org/index.php/User_documentation

Where did you install the Compiler?
What operating system?
What error did you get? Post the build log information.

Tim S.
« Last Edit: November 14, 2022, 11:58:45 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org