Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8237439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:28:13+00:00 2026-06-07T19:28:13+00:00

I am trying to compile a very simple program, I dont understand why it

  • 0

I am trying to compile a very simple program, I dont understand why it doesn’t compile. Here is my program:

/* General includes */
#include <stdio.h>
#include <stdlib.h>
#include <libpic30.h>
#include <p33FJ128GP804.h>

#include "RunLengthAlgorithm.h"
//#include "RunLengthAlgorithm.c"

int main(void) {

    int n;
    char source[10001];
    char target[100];

    for(n = 0; n < 1000; ++n){
        source[n] = "A";
    }
    for(n = 1000; n < 2000; ++n){
        source[n] = "B";
    }
    for(n = 2000; n < 3000; ++n){
        source[n] = "C";
    }
    for(n = 3000; n < 4000; ++n){
        source[n] = "D";
    }
    for(n = 4000; n < 5000; ++n){
        source[n] = "E";
    }
    for(n = 5000; n < 6000; ++n){
        source[n] = "F";
    }
    for(n = 6000; n < 7000; ++n){
        source[n] = "G";
    }
    for(n = 7000; n < 8000; ++n){
        source[n] = "H";
    }
    for(n = 8000; n < 9000; ++n){
        source[n] = "I";
    }
    for(n = 9000; n < 10000; ++n){
        source[n] = "J";
    }
    source[10001] = '\0';

    RLEncode(&source, &target);

    while(1);
    return (EXIT_SUCCESS);

}

The .h and .c files are added to project.

#ifndef RUNLENGTHALGORITHM_H
#define RUNLENGTHALGORITHM_H

void RLEncode (char *source, char *target);

#endif

And the .c file:

#ifndef RUNLENGTHALGORITHM_C
#define RUNLENGTHALGORITHM_C
void RLEncode (char *source, char *target){
    int n, k = 0;
    for(n = 0; source[n] != '\0'; ++n){
        int length = 1;
        while(source[n+1] != '\0' && source[n] == source[n+1]){
            ++length; ++n;
        }
        target[k++] = length;
        target[k++] = source[n];
    }
    source[n] = '\0';
}

#endif

I am using MPLAB-X IDE whith C30 compiler and it gives me this error:

CLEAN SUCCESSFUL (total time: 1s)
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory `D:/Datos (Disco)/Electronica/Multi portatil/Run-Length Algorithm.X'
make  -f nbproject/Makefile-default.mk dist/default/production/Run-Length_Algorithm.X.production.hex
make[2]: Entering directory `D:/Datos (Disco)/Electronica/Multi portatil/Run-Length Algorithm.X'
Main.c: In function 'main':
Main.c:24: warning: assignment makes integer from pointer without a cast
Main.c:27: warning: assignment makes integer from pointer without a cast
Main.c:30: warning: assignment makes integer from pointer without a cast
Main.c:33: warning: assignment makes integer from pointer without a cast
Main.c:36: warning: assignment makes integer from pointer without a cast
Main.c:39: warning: assignment makes integer from pointer without a cast
Main.c:42: warning: assignment makes integer from pointer without a cast
Main.c:45: warning: assignment makes integer from pointer without a cast
Main.c:48: warning: assignment makes integer from pointer without a cast
Main.c:51: warning: assignment makes integer from pointer without a cast
Main.c:55: warning: passing argument 1 of 'RLEncode' from incompatible pointer type
Main.c:55: warning: passing argument 2 of 'RLEncode' from incompatible pointer type
"C:\Program Files (x86)\Microchip\MPLAB C30\bin\pic30-gcc.exe" -g -omf=elf -x c -c -mcpu=33FJ128GP804 -MMD -MF build/default/production/Main.o.d -o **build/default/production/Main.o Main.c 
"C:\Program Files (x86)\Microchip\MPLAB C30\bin\pic30-gcc.exe" -g -omf=elf -x c -c -mcpu=33FJ128GP804 -MMD -MF build/default/production/RunLengthAlgorithm.o.d -o build/default/production/RunLengthAlgorithm.o RunLengthAlgorithm.c 
"C:\Program Files (x86)\Microchip\MPLAB C30\bin\pic30-gcc.exe"   -omf=elf -mcpu=33FJ128GP804  -o dist/default/production/Run-Length_Algorithm.X.production.elf build/default/production/Main.o build/default/production/RunLengthAlgorithm.o build/default/production/RunLengthAlgorithm.o        -Wl,--defsym=__MPLAB_BUILD=1,-Tp33FJ128GP804.gld
build/default/production/RunLengthAlgorithm.o(.text+0x0): In function `_RLEncode':
: multiple definition of `_RLEncode'
build/default/production/RunLengthAlgorithm.o(.text+0x0): first defined here
c:\program files (x86)\microchip\mplab c30\bin\bin\..\bin/pic30-elf-ld.exe: Link terminated due to previous error(s).**
make[2]: Leaving directory `D:/Datos (Disco)/Electronica/Multi portatil/Run-Length Algorithm.X'
make[1]: Leaving directory `D:/Datos (Disco)/Electronica/Multi portatil/Run-Length Algorithm.X'
**make[2]: *** [dist/default/production/Run-Length_Algorithm.X.production.hex] Error 255
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 8s)**

I don’t understand why, if I put my function inside Main.c and I dont’t include #include “RunLengthAlgorithm.h” it works but I cannot get it working including a file.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T19:28:14+00:00Added an answer on June 7, 2026 at 7:28 pm

    Ok there is no problem whit the code. It seems to be a bug of MPLAB-X v1.10.

    Solution: close MPLAB-X and open it again it will compile fine, if it doesn’t work read on http://www.microchip.com/forums/m627705.aspx.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am just trying to compile and run a very simple test program, but
I’m trying to compile a very simple Hello world OpenGL 3.3 program using FreeGLUT.
I am trying to compile a very simple C program. Installed MinGW using auto
I am trying to cross-compile a very simple program for Android that worked with
I'm trying to compile a very simple program that makes a connection to a
I'm trying to compile a very simple program in Java 1.6 on Ubuntu Jaunty,
I have a very simple example program that I am trying to compile, but
I'm trying to compile a very simple c++ code and get a linking error
I'm trying to use AppWeb, and i wrote a very simple program to embed
I am trying to compile the following very very simple piece of source code:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.