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 7838693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:10:49+00:00 2026-06-02T15:10:49+00:00

So i am trying to run some c code that compiles perfectly in windows

  • 0

So i am trying to run some c code that compiles perfectly in windows and am trying to run the same code using Xcode and the gcc compiler and when i try to compile i get this error in my code

Undefined symbols for architecture x86_64:
“_stricmp”, referenced from:
_PrintResults in cckZHFWV.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status

and cannot figure out why i am receiving this error

here is the code i am trying to compile

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "definitions.h"

//#define DEBUG 1

int main(int argc, char *argv[]) {
    FILE *config_file, *trace;
    unsigned int address, exec_info;
    char check, trash[25], op;
    int j, para;
    int i=0;

    //    char valid,dirty;
    //    unsigned int tag;
    //    next *tagstr;
    //    bptr tptr
    //    check if tptr is at head of list dont use bptr, dummy pointer

    if(argc >= 2)   
    config_file = fopen(argv[1],"r");    
    else 
    config_file = fopen("config0.txt","r");

    // Grabs desired cache parameters from the specified config files
    while(fscanf(config_file,"%s %d\n",trash,&para) == 2) {
    config[i] = para;
   i++;      
    }

    // Close the config file
    fclose(config_file);

    // Puts Cache parameters from config file in desired variables
    InitializeParameters();

    // Initializes the L1 and L2 caches into Linked List
    CacheInit();

    // Checks to see if file exists
    trace = fopen("I10.txt","r");
    if (!trace) {
    puts("I1.txt not found!");
    return 1;
    }

    while (fscanf(trace,"%c %x %x\n",&op,&address,&exec_info) == 3) {
    //printf("Op is %c, Address is %x, and exec is %x\n",op,address,exec_info); 
    switch(op) {
    case 'L': {
        load_count++;
        total++;
        //printf("Welcome to Load.\n");
        // do something
    }
    break;      
    case 'S': {
        store_count++;
        total++;
        //printf("Welcome to Store.\n");
        // do something here also
    }
    break;
    case 'B': {
        branch_count++;
        total++;
        //printf("Welcome to Branch.\n");
        // oh, don't forget this
    }
    break;      
    case 'C': {
        comp_count++;
        total++;
        //printf("Welcome to Computation.\n");        
        // Here, too 
    }
    break;
    }   // Handles incoming Operation data   
    }

    // Prints the Results of the Simulation
    PrintResults(argv[1]);
}

int InitializeParameters() {   
    L1_cache_size = config[0];
    L1_block_size = config[1];
    L1_assoc = config[2];
    L1_hit_time = config[3];
    L1_miss_time = config[4];
    L2_block_size = config[5];
    L2_cache_size = config[6];
    L2_assoc = config[7];
    L2_hit_time = config[8];
    L2_miss_time = config[9];
    L2_transfer_time = config[10];
    L2_bus_width = config[11];
    mem_sendaddr=config[12];
    mem_ready=config[13];
    mem_chunktime=config[14];
    mem_chunksize=config[15];    
}

int CacheInit() {
if(L1_assoc == 0){
L1_assoc = L1_cache_size / L1_block_size;
L1_sets = 1;
}
else
L1_sets = L1_cache_size / L1_block_size / L1_assoc;

if(L2_assoc == 0){
L2_assoc = L2_cache_size / L2_block_size;
L2_sets = 1;
}
else
L2_sets = L2_cache_size / L2_block_size / L2_assoc;    
}

int PrintResults(char *config_file) {
printf("--------------------------------------------------------\n");
printf("                   Simulation Results\n");
printf("--------------------------------------------------------\n");

// Trace File
printf("Trace File:\n");

// Cache Name
printf("Cache Type: ");
if (config_file == NULL)
printf("Direct Mapped\n\n");
if (stricmp("config0.txt",config_file) == 0)
printf("Direct Mapped\n\n");
if (stricmp("config1.txt",config_file) == 0)
printf("L1-2way\n\n");
if (stricmp("config2.txt",config_file) == 0)
printf("L2-2way\n\n");
if (stricmp("config3.txt",config_file) == 0)
printf("All-2way\n\n");
if (stricmp("config4.txt",config_file) == 0)
printf("2-4-way\n\n");
if (stricmp("config5.txt",config_file) == 0)
printf("L2-Big\n\n");
if (stricmp("config6.txt",config_file) == 0)
printf("All-FA\n\n");
if (stricmp("config7.txt",config_file) == 0)
printf("Direct Mapped 2 x Memory Chunksize\n\n");
if (stricmp("config8.txt",config_file) == 0)
printf("Direct Mapped 4 x Memory Chunksize%s\n\n");     

// Cache info
printf("Memory System:\n");
printf("  DCache Size = %Lu : Ways = %Lu : Block Size = %Lu\n",
   L1_cache_size, L1_assoc, L1_block_size);
printf("  ICache Size = %Lu : Ways = %Lu : Block Size = %lu\n",
   L1_cache_size, L1_assoc, L1_block_size);
printf("  L2-Cache Size = %Lu : Ways = %Lu : Block Size = %lu\n",
   L2_cache_size, L2_assoc, L2_block_size);
printf("  Memory Ready Time = %Lu : Chunksize = %Lu : Chunktime = %lu\n\n", mem_ready, mem_chunksize, mem_chunktime);

// Time
printf("Time:\n");
printf("  Execute Time = %Lu :", time);
printf(" Total Refs = %Lu\n", total + data_refs);
printf("  Inst Refs = %Lu :", total);
printf(" Data Refs = %Lu\n\n", data_refs);

// Number of Instructions
printf("Number of Instructions: [Percentage]\n");
printf("  Loads  (L) = %Lu",load_count);
printf(" [%.1f%%] :",100*load_count/ (double) total);
printf(" Stores (S) = %Lu",store_count);
printf(" [%.1f%%]\n",100*store_count/ (double) total);
printf("  Branch (B) = %Lu",branch_count);
printf(" [%.1f%%] :",100*branch_count/ (double) total);
printf(" Comp   (C) = %Lu",comp_count);
printf(" [%.1f%%]\n",100*comp_count/ (double) total);
printf("  Total  (T) = %Lu\n\n",total);

// Number of Cycles
printf("Cycles for Instructions: [Percentage]\n");
printf("  Loads  (L) = %Lu",load_cycle);
printf(" [%.1f%%] :",100*load_cycle/ (double) total_cycle);
printf(" Stores (S) = %Lu",store_cycle);
printf(" [%.1f%%]\n",100*store_cycle/ (double) total_cycle);
printf("  Branch (B) = %Lu",branch_cycle);
printf(" [%.1f%%] :",100*branch_cycle/ (double) total_cycle);
printf(" Comp   (C) = %Lu",comp_cycle);
printf(" [%.1f%%]\n",100*comp_cycle/ (double) total_cycle);
printf("  Total  (T) = %Lu\n\n",total_cycle);

// CPI
printf("Cycles Per Instructions:\n");
printf("  Loads      (L) = %.1f :", load_cycle/(double) load_count);
printf("  Stores (S) = %.1f%\n", store_cycle/(double) store_count);
printf("  Branch     (B) = %.1f :",
   branch_cycle/(double) branch_count);
printf("  Comp   (C) = %.1f\n", comp_cycle/ (double) comp_count);
printf("  Overall  (CPI) = %Lu\n\n", total_cycle/ (double) total);

// Real/Simulated Comparision
printf("Perfect to Simulation Comparision:\n");
printf("  Cycles for Processor w/Perfect Memory System %Lu\n",
   perfect_cycle);
printf("  Cycles for Processor w/Simulated Memory System %Lu\n",
   total_cycle);
printf("  Ratio of Simulated/Perfect Performance = %.6f\n\n",
   total_cycle/ (double) perfect_cycle );

// L1 ICache Hit/Miss
printf("Memory Level: L1 ICache\n");
printf("  Hit Count = %Lu : ", L1_I_hits);
printf("Miss Count = %Lu : ", L1_I_misses);
printf("Hit Count = %Lu\n", L1_I_hits+L1_I_misses);
printf("  Hit Rate = %.1f%% : Miss Rate = %.1f%%\n",
   100*L1_I_hits / (double) (L1_I_hits + L1_I_misses),
   100*L1_I_misses / (double) (L1_I_hits + L1_I_misses));
printf("  Kickouts = %Lu : ", L1_I_kickouts);
printf("Dirty Kickouts = %Lu : ", L1_I_kickouts_dirty);
printf("Transfers = %Lu\n\n", L1_I_transfers);

// L1 DCache Hit/Miss
printf("Memory Level: L1 DCache\n");
printf("  Hit Count = %Lu : ", L1_D_hits);
printf("Miss Count = %Lu : ", L1_D_misses);
printf("Hit Count = %Lu\n", L1_D_hits+L1_D_misses);
printf("  Hit Rate = %.1f%% : Miss Rate = %.1f%%\n",
   100*L1_D_hits / (double) (L1_D_hits + L1_D_misses),
   100*L1_D_misses / (double) (L1_D_hits + L1_D_misses));
printf("  Kickouts = %Lu : ", L1_D_kickouts);
printf("Dirty Kickouts = %Lu : ", L1_D_kickouts_dirty);
printf("Transfers = %Lu\n\n", L1_D_transfers);

// L2 Cache Hit/Miss
printf("Memory Level: L2\n");
printf("  Hit Count = %Lu : ", L2_hits);
printf("Miss Count = %Lu : ", L2_misses);
printf("Hit Count = %Lu\n", L2_hits+L2_misses);
printf("  Hit Rate = %.1f%% : Miss Rate = %.1f%%\n",
   100*L2_hits / (double) (L2_hits + L1_D_misses),
   100*L2_misses / (double) (L2_hits + L2_misses));
printf("  Kickouts = %Lu : ", L2_kickouts);
printf("Dirty Kickouts = %Lu : ", L2_kickouts_dirty);
printf("Transfers = %Lu\n\n", L2_transfers);

// Cost Analysis
printf("Cost:\n");
//L1 Cache Cost
L1_cost = (L1_cache_size / 4096) * 100 * (log2(L1_assoc) + 1);
cost += L1_cost*2;
printf("  L1 Cache Cost (ICache $%Lu) + (DCache $%Lu) = $%Lu\n",
   L1_cost, L1_cost, L1_cost*2);

// L2 Cache Cost
L2_cost = (L2_cache_size / (64*1024)) * 50 * (log2(L2_assoc) + 1);
cost += L2_cost;
printf("  L2 Cache Cost = $%Lu\n", L2_cost);

// Memory Cost
mem_cost = log2(100 / mem_ready) * 200 + 50;
mem_cost += (log2(mem_chunksize)-4)*100 + 25;
cost += mem_cost;
printf("  Memory Cost = $%Lu\n", mem_cost);

// Total Cost
printf("  Total Cost = $%Lu\n", cost);
}

Thanks for any help

  • 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-02T15:10:51+00:00Added an answer on June 2, 2026 at 3:10 pm

    stricmp is not a standard library function and not portable. strcasecmp is the portable function.

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

Sidebar

Related Questions

I am new to Linux and I am trying to compile some code that
If there is some code that 2 threads trying to write to the same
Here is some Verilog code that I'm trying to run in Modelsim. parameter Data_width
i am trying to compile some code to memory at runtime using a CodeDomProvider.
Was trying to compile some code from this SO question and run into this
Ultimately I am trying to run some code which depends on the value (or
I'm trying to run some python code under Apache 2.2 / mod_python 3.2.8. Eventually
I am trying to run some Scala code on my OSX machine and keep
Where would set_include_path(../../); point to? I am trying to run some PHP code on
I'm a student, and I'm trying to write and run some test code for

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.