relocation truncated, R_X86_64_PC32 against undefined symbol









up vote
0
down vote

favorite












In this C program, I needed to make a a queue applciation in a structured approach. As I was trying to run this program in netbeans, i saw that i was getting a relocation truncated error. My professor told me to run it in Clion and I'm still getting the same exact error. The error is specifically stating that im having undefined reference to 'dequeue', 'enqueue', and 'getCurrentSize'.



#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

bool enqueue(int** queue, int* size, int value);
void dequeue(int** queue, int* size);
int getCurrentSize(int size);
void display(int* intQueue, int size);

int main()

int input;
int initSize = 3;
int size = 0;
char option = 'a';
char answer = 'y';
int value;

bool enqueueResult, dequeueResult = true;

int* queue = (int*)malloc(initSize * sizeof(int));
for (int i = 0; i<initSize; i++)
queue[i] = 0;

printf("This program implements Queues using structured programming. Enter "
"a number from 1 to 4 . n"
"1. To enqueue a number n"
"2. To dequeue a number n"
"3. To get the current size of the queue n"
"4. To see the contents within the queue n"
"5. Exit the program");
scanf("%d", &input);

switch (input)

case 1:
enqueueResult = enqueue(&queue, &size, value);

if (enqueueResult == true)
printf("The number has been put into the queue!");

else
printf("The number was not able to be enqueued!");
break;

case 2:
dequeue(&queue, &size);

printf("Number was dequeued from the queue");
break;

case 3:
printf("The current size of the queue is: " + getCurrentSize(size));
break;

free(queue);
return 0;



//********************************************************
//QueueLibrary.c below

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

bool enqueue(int** queue, int* size, int value)

int maxSize = *size + 1;

if (*queue == NULL)
return false;

if (*size < 0)
return false;

if (*size == maxSize)

int* copy = (int*)malloc((maxSize + 1) * sizeof(int));

if (copy == NULL)
return false;
maxSize += 1;

for (int i = 0; i < *size; i++)
copy[i] = (*queue)[i];

free(*queue);
*queue = copy;


for (int i = *size; i > *size - 1; i--)

(*queue)[i] = value;
printf("The value %d has been added to the queuen", (*queue)[i]);

*size += 1;
return true;


void dequeue(int** intQueue, int* size)

printf("%d has left the queuen", *intQueue[0]);

for (int i = 0; i < *size; i++)
(*intQueue)[i] = (*intQueue)[i + 1];

if (*size != 0)
*size -= 1;

else
printf("There is nothing left in the queuen");



int getCurrentSize(int size)

return size;


void display(int* intQueue, int size)

printf("The integers in the queue are :n");
for (int i = 0; i < size; i++)
printf("%dn", intQueue[i]);




This is the error message










share|improve this question























  • You should show the exact error messages you're getting and the command line that produced them.
    – R..
    Nov 9 at 2:51










  • i edited the the post to show the error
    – Doe J.
    Nov 9 at 3:05






  • 3




    You are failing to compile and link in the QueueLibrary.c. You need to update your build process to be sure that file is handled too.
    – abelenky
    Nov 9 at 3:08














up vote
0
down vote

favorite












In this C program, I needed to make a a queue applciation in a structured approach. As I was trying to run this program in netbeans, i saw that i was getting a relocation truncated error. My professor told me to run it in Clion and I'm still getting the same exact error. The error is specifically stating that im having undefined reference to 'dequeue', 'enqueue', and 'getCurrentSize'.



#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

bool enqueue(int** queue, int* size, int value);
void dequeue(int** queue, int* size);
int getCurrentSize(int size);
void display(int* intQueue, int size);

int main()

int input;
int initSize = 3;
int size = 0;
char option = 'a';
char answer = 'y';
int value;

bool enqueueResult, dequeueResult = true;

int* queue = (int*)malloc(initSize * sizeof(int));
for (int i = 0; i<initSize; i++)
queue[i] = 0;

printf("This program implements Queues using structured programming. Enter "
"a number from 1 to 4 . n"
"1. To enqueue a number n"
"2. To dequeue a number n"
"3. To get the current size of the queue n"
"4. To see the contents within the queue n"
"5. Exit the program");
scanf("%d", &input);

switch (input)

case 1:
enqueueResult = enqueue(&queue, &size, value);

if (enqueueResult == true)
printf("The number has been put into the queue!");

else
printf("The number was not able to be enqueued!");
break;

case 2:
dequeue(&queue, &size);

printf("Number was dequeued from the queue");
break;

case 3:
printf("The current size of the queue is: " + getCurrentSize(size));
break;

free(queue);
return 0;



//********************************************************
//QueueLibrary.c below

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

bool enqueue(int** queue, int* size, int value)

int maxSize = *size + 1;

if (*queue == NULL)
return false;

if (*size < 0)
return false;

if (*size == maxSize)

int* copy = (int*)malloc((maxSize + 1) * sizeof(int));

if (copy == NULL)
return false;
maxSize += 1;

for (int i = 0; i < *size; i++)
copy[i] = (*queue)[i];

free(*queue);
*queue = copy;


for (int i = *size; i > *size - 1; i--)

(*queue)[i] = value;
printf("The value %d has been added to the queuen", (*queue)[i]);

*size += 1;
return true;


void dequeue(int** intQueue, int* size)

printf("%d has left the queuen", *intQueue[0]);

for (int i = 0; i < *size; i++)
(*intQueue)[i] = (*intQueue)[i + 1];

if (*size != 0)
*size -= 1;

else
printf("There is nothing left in the queuen");



int getCurrentSize(int size)

return size;


void display(int* intQueue, int size)

printf("The integers in the queue are :n");
for (int i = 0; i < size; i++)
printf("%dn", intQueue[i]);




This is the error message










share|improve this question























  • You should show the exact error messages you're getting and the command line that produced them.
    – R..
    Nov 9 at 2:51










  • i edited the the post to show the error
    – Doe J.
    Nov 9 at 3:05






  • 3




    You are failing to compile and link in the QueueLibrary.c. You need to update your build process to be sure that file is handled too.
    – abelenky
    Nov 9 at 3:08












up vote
0
down vote

favorite









up vote
0
down vote

favorite











In this C program, I needed to make a a queue applciation in a structured approach. As I was trying to run this program in netbeans, i saw that i was getting a relocation truncated error. My professor told me to run it in Clion and I'm still getting the same exact error. The error is specifically stating that im having undefined reference to 'dequeue', 'enqueue', and 'getCurrentSize'.



#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

bool enqueue(int** queue, int* size, int value);
void dequeue(int** queue, int* size);
int getCurrentSize(int size);
void display(int* intQueue, int size);

int main()

int input;
int initSize = 3;
int size = 0;
char option = 'a';
char answer = 'y';
int value;

bool enqueueResult, dequeueResult = true;

int* queue = (int*)malloc(initSize * sizeof(int));
for (int i = 0; i<initSize; i++)
queue[i] = 0;

printf("This program implements Queues using structured programming. Enter "
"a number from 1 to 4 . n"
"1. To enqueue a number n"
"2. To dequeue a number n"
"3. To get the current size of the queue n"
"4. To see the contents within the queue n"
"5. Exit the program");
scanf("%d", &input);

switch (input)

case 1:
enqueueResult = enqueue(&queue, &size, value);

if (enqueueResult == true)
printf("The number has been put into the queue!");

else
printf("The number was not able to be enqueued!");
break;

case 2:
dequeue(&queue, &size);

printf("Number was dequeued from the queue");
break;

case 3:
printf("The current size of the queue is: " + getCurrentSize(size));
break;

free(queue);
return 0;



//********************************************************
//QueueLibrary.c below

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

bool enqueue(int** queue, int* size, int value)

int maxSize = *size + 1;

if (*queue == NULL)
return false;

if (*size < 0)
return false;

if (*size == maxSize)

int* copy = (int*)malloc((maxSize + 1) * sizeof(int));

if (copy == NULL)
return false;
maxSize += 1;

for (int i = 0; i < *size; i++)
copy[i] = (*queue)[i];

free(*queue);
*queue = copy;


for (int i = *size; i > *size - 1; i--)

(*queue)[i] = value;
printf("The value %d has been added to the queuen", (*queue)[i]);

*size += 1;
return true;


void dequeue(int** intQueue, int* size)

printf("%d has left the queuen", *intQueue[0]);

for (int i = 0; i < *size; i++)
(*intQueue)[i] = (*intQueue)[i + 1];

if (*size != 0)
*size -= 1;

else
printf("There is nothing left in the queuen");



int getCurrentSize(int size)

return size;


void display(int* intQueue, int size)

printf("The integers in the queue are :n");
for (int i = 0; i < size; i++)
printf("%dn", intQueue[i]);




This is the error message










share|improve this question















In this C program, I needed to make a a queue applciation in a structured approach. As I was trying to run this program in netbeans, i saw that i was getting a relocation truncated error. My professor told me to run it in Clion and I'm still getting the same exact error. The error is specifically stating that im having undefined reference to 'dequeue', 'enqueue', and 'getCurrentSize'.



#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

bool enqueue(int** queue, int* size, int value);
void dequeue(int** queue, int* size);
int getCurrentSize(int size);
void display(int* intQueue, int size);

int main()

int input;
int initSize = 3;
int size = 0;
char option = 'a';
char answer = 'y';
int value;

bool enqueueResult, dequeueResult = true;

int* queue = (int*)malloc(initSize * sizeof(int));
for (int i = 0; i<initSize; i++)
queue[i] = 0;

printf("This program implements Queues using structured programming. Enter "
"a number from 1 to 4 . n"
"1. To enqueue a number n"
"2. To dequeue a number n"
"3. To get the current size of the queue n"
"4. To see the contents within the queue n"
"5. Exit the program");
scanf("%d", &input);

switch (input)

case 1:
enqueueResult = enqueue(&queue, &size, value);

if (enqueueResult == true)
printf("The number has been put into the queue!");

else
printf("The number was not able to be enqueued!");
break;

case 2:
dequeue(&queue, &size);

printf("Number was dequeued from the queue");
break;

case 3:
printf("The current size of the queue is: " + getCurrentSize(size));
break;

free(queue);
return 0;



//********************************************************
//QueueLibrary.c below

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

bool enqueue(int** queue, int* size, int value)

int maxSize = *size + 1;

if (*queue == NULL)
return false;

if (*size < 0)
return false;

if (*size == maxSize)

int* copy = (int*)malloc((maxSize + 1) * sizeof(int));

if (copy == NULL)
return false;
maxSize += 1;

for (int i = 0; i < *size; i++)
copy[i] = (*queue)[i];

free(*queue);
*queue = copy;


for (int i = *size; i > *size - 1; i--)

(*queue)[i] = value;
printf("The value %d has been added to the queuen", (*queue)[i]);

*size += 1;
return true;


void dequeue(int** intQueue, int* size)

printf("%d has left the queuen", *intQueue[0]);

for (int i = 0; i < *size; i++)
(*intQueue)[i] = (*intQueue)[i + 1];

if (*size != 0)
*size -= 1;

else
printf("There is nothing left in the queuen");



int getCurrentSize(int size)

return size;


void display(int* intQueue, int size)

printf("The integers in the queue are :n");
for (int i = 0; i < size; i++)
printf("%dn", intQueue[i]);




This is the error message







c declaration relocation






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 9 at 3:00

























asked Nov 9 at 2:46









Doe J.

62




62











  • You should show the exact error messages you're getting and the command line that produced them.
    – R..
    Nov 9 at 2:51










  • i edited the the post to show the error
    – Doe J.
    Nov 9 at 3:05






  • 3




    You are failing to compile and link in the QueueLibrary.c. You need to update your build process to be sure that file is handled too.
    – abelenky
    Nov 9 at 3:08
















  • You should show the exact error messages you're getting and the command line that produced them.
    – R..
    Nov 9 at 2:51










  • i edited the the post to show the error
    – Doe J.
    Nov 9 at 3:05






  • 3




    You are failing to compile and link in the QueueLibrary.c. You need to update your build process to be sure that file is handled too.
    – abelenky
    Nov 9 at 3:08















You should show the exact error messages you're getting and the command line that produced them.
– R..
Nov 9 at 2:51




You should show the exact error messages you're getting and the command line that produced them.
– R..
Nov 9 at 2:51












i edited the the post to show the error
– Doe J.
Nov 9 at 3:05




i edited the the post to show the error
– Doe J.
Nov 9 at 3:05




3




3




You are failing to compile and link in the QueueLibrary.c. You need to update your build process to be sure that file is handled too.
– abelenky
Nov 9 at 3:08




You are failing to compile and link in the QueueLibrary.c. You need to update your build process to be sure that file is handled too.
– abelenky
Nov 9 at 3:08

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53219135%2frelocation-truncated-r-x86-64-pc32-against-undefined-symbol%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53219135%2frelocation-truncated-r-x86-64-pc32-against-undefined-symbol%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Crossroads (UK TV series)

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế