Author Topic: 16.01 installed, C program will not build  (Read 7695 times)

Offline Feleppa

  • Single posting newcomer
  • *
  • Posts: 2
16.01 installed, C program will not build
« on: June 26, 2016, 07:34:41 pm »
Can anyone help me out?

I'm working through a 'C Programming Absolute Beginner's Guide' here and have just installed 16.01 on a new computer, after working smoothly through chapters 1-14 on my previous one.

Just coded the program from Chapter 15 and it will not build.

I am clicking the yellow wheel as usual it has no impact.

A yellow 'Can't find compiler executable...' error message just popped up too...

Any thoughts?
« Last Edit: June 26, 2016, 07:39:59 pm by Feleppa »

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: 16.01 installed, C program will not build
« Reply #1 on: June 26, 2016, 09:32:56 pm »
Install a compiler, simply as that. Remember that codeblocks is not a compiler, but a ide...

(you are not telling us what operating system you are using, so we can not help more....)

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: 16.01 installed, C program will not build
« Reply #2 on: June 26, 2016, 09:34:39 pm »
Yes, you likely need to install a compiler.

Read the first two General FAQs http://wiki.codeblocks.org/index.php/FAQ#General
And, see if this link still helps newbies with this issue http://wiki.codeblocks.org/index.php/Installing_a_supported_compiler#Compiler-neutral_setup_steps

Tim S.
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

Offline Feleppa

  • Single posting newcomer
  • *
  • Posts: 2
Re: 16.01 installed, C program will not build
« Reply #3 on: July 03, 2016, 12:59:23 pm »
Thank you both.  I'm using Windows 10, and justr followed BlueHazzard's & stahta01's advice.  The compiler was detected and the program now attempts to compile.  However, it did not compile and here is the error message:

||=== Build file: "no target" in "no project" (compiler: unknown) ===|
||error: C:\Users\jfele\OneDrive\??\2.Learning\f. My own studies\Computing\C\25.c: Invalid argument|
||error: no input files|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

I just walked through my code and did not find any errors.  Is it because it cannot include the two #include .h files?

Is this another easy fix?

Appreciate any help.  Here is my short program:

// Example program #1 from Chapter 15 of Absolute Beginner's Guide
// to C, 3rd Edition
// File Chapter15ex1.c

/* This program will ask users how many movies they've seen this
year, and then loop through asking the name of each movie and a
rating from 1 to 10.  It will remember their favourite movie and
their least favourite movie. */

#include <stdio.h>
#include <string.h>

main()
{

    int ctr, numMovies, rating, favRating, leastRating;
    char movieName[40], favorite[40], least[40];

    // Initialize the favRating to 0 so any movie with any rating of
    // 1 or higher will replace it and the leastRating to 10 so any
    // movie rated 9 or lower will replace it

    favRating = 0;
    leastRating = 10;

    // Find out how many movies the user has seen and can rate
    // The loop will continue until they enter a number more than 0

    do {
        printf("How many movies have you seen this year?");
        scanf(" %d", &numMovies);

        // If the user enters 0 or a negative number, the program
        // will remind them to enter a positive number and prompt
        // them again

        if (numMovies < 1)
        {
            printf("No movies!  How can you rank them?\nTry again!\n\n");
        }
    } while (numMovies < 1);

    for (ctr = 1; ctr <= numMovies; ctr++)
        {
                // Get the name of the movie and the user's rating

                printf("\nWhat was the name of the movie? ");
                printf("(1-word titles only!) ");
                scanf(" %s", movieName);
                printf("On a scale of 1 to 10, what would ");
                printf("you rate it? ");
                scanf(" %d", &rating);

                // Check whether it's their best-rated movie so far
                if (rating > favRating)
                {
                    strcpy(favorite, movieName);
                    favRating = rating;
                }
                // Check whether it's their worst-rated movie so far
                if (rating < leastRating)
                {
                    strcpy(least, movieName);
                    leastRating = rating;
                }
        }
    printf("\nYour favourite movie was %s.\n", favorite);
    printf("\nYour least favourite movie was %s.\n", least);

    return 0;

}

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: 16.01 installed, C program will not build
« Reply #4 on: July 03, 2016, 01:39:49 pm »
1) Please use code tags if you post code or logs (click on the # symbol in the new post editor and paste your log/code between the two "code" tags)
2) Don't use empty spaces or non ASCII letters in your project path or source files... This is a limitation that comes with history of computation..

if you have future errors please consider to read this and follow the rules pointed out there:
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_(general)#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F

greetings

Offline JamesYeoman

  • Single posting newcomer
  • *
  • Posts: 2
Re: 16.01 installed, C program will not build
« Reply #5 on: August 27, 2016, 11:23:37 am »
Isn't this part of the forum supposed to be to do with development OF codeblocks?
Whoever thought letting the two presidential candidates out of their cages was a good idea... NEEDS TO BE SHOT!

Even here in the UK we're not safe. Those people will be in control of nuclear missiles...

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: 16.01 installed, C program will not build
« Reply #6 on: August 27, 2016, 08:12:39 pm »
Isn't this part of the forum supposed to be to do with development OF codeblocks?

You are correct; a newbie who can read is a very rare newbie indeed!

Tim S.

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