Linker error using system(*.*)

This is a discussion on Linker error using system(*.*) within the C Programming forums, part of the General Programming Boards category; OS: Win2k Compiler: Borland Turbo C++ v 4.52 Code: #include <stdlib.h> #include <stdio.h> int main(void) { printf("About to spawn command.com ...

  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    4

    Linker error using system(*.*)

    OS: Win2k
    Compiler: Borland Turbo C++ v 4.52

    Code:
    #include <stdlib.h>
    #include <stdio.h>
    
    int main(void)
    {
       printf("About to spawn command.com and run a DOS command\n");
       system("dir");
       return 0;
    }
    Issue:
    The above code compiles just fine. When I rebuild (which includes linking) I get the following error message:

    Compiling TEST1.CPP:
    Linking test1.exe:
    Linker Warning: No module definition file specified: using defaults
    Linker Error: Undefined symbol _system in module TEST1.CPP.

    (Throws the same linker error for all of the "execl" series commands as well.)

    I've changed the system command to system() and rebuilt. The error changes to a compile error "too few parameters in call to system(const *char)... like we would normally expect.

    I have a feeling I'm missing something really simple here but, not having seen this before, I am at a loss.

    Any kick in the right direction would be greatly appreciated.

    Many thanks!

    Dan

  2. #2
    Registered User
    Join Date
    May 2003
    Posts
    4

    Lightbulb Enterprise Compiler

    I would bite on the student version angle if I weren't using an Enterprise edition.

    But, I think you may be on to something. I'll try a different compiler.

    Thank you, Salem.

  3. #3
    Registered User
    Join Date
    May 2003
    Posts
    4

    Different Compiler Worked

    Many Thanks, Salem: The third compiler worked!

    For anyone interested: The compiler that ended up doing the job was the Bloodshed Dev-C++. A freebie that, at least initially, looks as capable as anything I've been exposed to thus far.

  4. #4
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    In regard to the first posting, what type of target are you trying to build? I get this same linker output when I set the target platform to Windows 3.x (16). As a Win32 Console app it's fine.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  5. #5
    Registered User
    Join Date
    May 2003
    Posts
    4

    Dave_Sinkula: direct hit!

    Changed target type to Application, Win32, Console and rebuild the source file.

    EUREKA! A perfect compile and link.

    I'd like to take this opportunity to thank everyone who took the time to change into boots and give me a good kick. My rear-end is pretty sore now. I'm taking my ball and going home.......

  6. #6
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    And just to clarify:
    >>The compiler that ended up doing the job was the Bloodshed Dev-C++<<
    Bloodshed is not a compiler, it's an IDE.
    http://www.bloodshed.net/devcpp.html

    But, hey, it did the job, so who cares
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linker errors
    By jw232 in forum C++ Programming
    Replies: 3
    Last Post: 06-12-2009, 01:56 PM
  2. Linker problem... no idea
    By cyreon in forum C Programming
    Replies: 2
    Last Post: 04-03-2009, 03:53 PM
  3. linker
    By George2 in forum C++ Programming
    Replies: 6
    Last Post: 02-23-2008, 01:25 AM
  4. I am gonna kill myself...linker error !!!
    By roalme00 in forum C++ Programming
    Replies: 1
    Last Post: 09-02-2007, 12:34 PM
  5. Linker errors in VC++ 2005
    By C+/- in forum C++ Programming
    Replies: 0
    Last Post: 05-18-2007, 08:42 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21