Solved

cannot find -lib file

Posted on 2006-11-27
2
532 Views
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) {
      rewind(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) {
      CU_cleanup_registry();
      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)))
   {
      CU_cleanup_registry();
      return CU_get_error();
   }

   /* Run all tests using the CUnit Basic interface */
   CU_basic_set_mode(CU_BRM_VERBOSE);
   CU_basic_run_tests();
   CU_cleanup_registry();
   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. :(

0
Comment
Question by:rrahulgupta
2 Comments
 
LVL 86

Accepted Solution

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

-lcunit -lcunit_dll
0
 

Author Comment

by:rrahulgupta
ID: 18021540
Thanks :)
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to update multiple binary circular files in C 3 225
Trouble linking program with -lcrypt 3 142
How to align numbers in C using the %d 2 89
chcp 65001 File encoding 66 231
An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

863 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now