cannot find -lib file

Posted on 2006-11-27
Medium Priority
Last Modified: 2007-12-19
Hi! Experts,
I'm trying to run this code. I'm using dev-c++ to run this.

//== main.c ====================
#include <stdio.h>
#include <string.h>
#include "CUnit/Basic.h"

/* Pointer to the file used by the tests. */
static FILE* temp_file = NULL;

/* The suite initialization function.
 * Opens the temporary file used by the tests.
 * Returns zero on success, non-zero otherwise.
int init_suite1(void)
   if (NULL == (temp_file = fopen("temp.txt", "w+"))) {
      return -1;
   else {
      return 0;

/* The suite cleanup function.
 * Closes the temporary file used by the tests.
 * Returns zero on success, non-zero otherwise.
int clean_suite1(void)
   if (0 != fclose(temp_file)) {
      return -1;
   else {
      temp_file = NULL;
      return 0;

/* Simple test of fprintf().
 * Writes test data to the temporary file and checks
 * whether the expected number of bytes were written.
void testFPRINTF(void)
   int i1 = 10;

   if (NULL != temp_file) {
      CU_ASSERT(0 == fprintf(temp_file, ""));
      CU_ASSERT(2 == fprintf(temp_file, "Q\n"));
      CU_ASSERT(7 == fprintf(temp_file, "i1 = %d", i1));

/* Simple test of fread().
 * Reads the data previously written by testFPRINTF()
 * and checks whether the expected characters are present.
 * Must be run after testFPRINTF().
void testFREAD(void)
   unsigned char buffer[20];

   if (NULL != temp_file) {
      CU_ASSERT(9 == fread(buffer, sizeof(unsigned char), 20, temp_file));
      CU_ASSERT(0 == strncmp(buffer, "Q\ni1 = 10", 9));

/* The main() function for setting up and running the tests.
 * Returns a CUE_SUCCESS on successful running, another
 * CUnit error code on failure.
int main()
   CU_pSuite pSuite = NULL;

   /* initialize the CUnit test registry */
   if (CUE_SUCCESS != CU_initialize_registry())
      return CU_get_error();

   /* add a suite to the registry */
   pSuite = CU_add_suite("Suite_1", init_suite1, clean_suite1);
   if (NULL == pSuite) {
      return CU_get_error();

   /* add the tests to the suite */
   /* NOTE - ORDER IS IMPORTANT - MUST TEST fread() AFTER fprintf() */
   if ((NULL == CU_add_test(pSuite, "test of fprintf()", testFPRINTF)) ||
       (NULL == CU_add_test(pSuite, "test of fread()", testFREAD)))
      return CU_get_error();

   /* Run all tests using the CUnit Basic interface */
   return CU_get_error();

It's giving error when I compile it, even I have already provided the path of "lib" folders.
Result of make file:
Compiler: Default compiler
Building Makefile: "C:\working\Dev-Cpp\essconfig_api\Makefile.win"
Executing  make...
make.exe -f "C:\working\Dev-Cpp\essconfig_api\Makefile.win" all
gcc.exe -D__DEBUG__ objs/conn_man.o objs/reach_pbx_config.o objs/reach_pbx_extn_map.o objs/sip_app_log_config.o objs/sip_call_config.o objs/sip_call_logs.o objs/sip_dial_plan.o objs/sip_dial_plan_dest.o objs/sip_license_config.o objs/sip_proxy_config.o objs/sip_proxy_domain.o objs/sip_proxy_server.o objs/sip_trunk_grp.o objs/sip_trunk_grp_member.o objs/sip_users.o objs/main.o objs/api_initializer.o  -o "exec\essconfig_api.exe" -L"C:/working/Dev-Cpp/lib" -L"C:/Program Files/CUnit-2.1-0/lib" -lmySQL  -libcunit -libcunit_dll  -g3
c:\MinGW\bin\..\lib\gcc-lib\mingw32\3.2.3\..\..\..\..\mingw32\bin\ld.exe: cannot find -libcunit

make.exe: *** [exec/essconfig_api.exe] Error 1
Execution terminated

Please tell me where I'm doing wrong. :(

Question by:rrahulgupta
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 86

Accepted Solution

jkr earned 2000 total points
ID: 18020906
According to the naming conventions that gcc usually follows, make that read

-lcunit -lcunit_dll

Author Comment

ID: 18021540
Thanks :)

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question