Thread: beginner question

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    7

    beginner question

    i am new to programming with C and i am trying to make a file that has already been written by someone else. i have the .mak file and the .c file, plus all of the libraries and header files in the right place. however i am not sure how to make the executable. i have Visual Studio as well and I can compile the program file, but i keep getting build errors. any suggestions?

  2. #2
    Registered User C_Coder's Avatar
    Join Date
    Oct 2001
    Posts
    522
    can we see the code and the errors?
    All spelling mistakes, syntatical errors and stupid comments are intentional.

  3. #3
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    Suggestion: give us an overview of the errors you get.

  4. #4
    Registered User
    Join Date
    Mar 2002
    Posts
    7
    i am getting a link error:
    LIBC.lib(wwincrt0.obj) : error LNK2001: unresolved external symbol _wWinMain@16

    i have read about what this error means and have tried a number of different solutions but i can't seem to get things working.

  5. #5
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    The linker is missing the main-function. Does a main-function appear in your sourcefiles?

    What is your OS?

  6. #6
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,212
    You need to compile it using a 32-bit windows compiler.

    16 bit doesn't support winMain.

  7. #7
    Registered User
    Join Date
    Mar 2002
    Posts
    7
    ya, i have a main function and my OS is 2000. my main is called NotesMain because I am using this with some Notes API stuff.

  8. #8
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    >my main is called NotesMain

    Your main function MUST be called main.

    Example:

    Code:
    int main (int argc, char **argv)
    {   
        return 0;
    }

  9. #9
    Registered User
    Join Date
    Mar 2002
    Posts
    7
    i don't think that is it. basically the code i have has already been built into an executable so i know that it is correct. i am trying to figure out how to rebuild it (so i can make changes to it). but so far i have been worthless on trying to just get an executable. that is kind of why i asked if having the .mak file would help. i did not know if just by having the .mak and .c files you could get the executable...i guess that was my main question.

  10. #10
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    I'm not sure about Visual Studio, but I know from other compilers there is a make-utility which you can use to make your software. You do something like:

    make makefile.mak

    But according to your error, I'm quite sure it is complaining about a missing main-function. It says:

    unresolved external symbol

    This often means that a function or variable which is declared as extern is used, but the linker can't find that function or variable.

  11. #11
    Registered User
    Join Date
    Mar 2002
    Posts
    7
    i will try to figure it out. thank you for the help.

  12. #12
    Registered User
    Join Date
    Mar 2002
    Posts
    7
    thank you for all of your insight guys, but i figured it out. since i already had the .mak file i just ran nmake -f fileName.mak and it worked great.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Beginner: Linked List question
    By WeatherMan in forum C++ Programming
    Replies: 2
    Last Post: 04-03-2008, 07:16 AM
  2. Quick IF statement question (beginner)
    By jim.rattlehead in forum C Programming
    Replies: 23
    Last Post: 11-29-2007, 06:51 AM
  3. beginner question
    By Barrot in forum C++ Programming
    Replies: 4
    Last Post: 08-19-2005, 02:17 PM
  4. Question About External Files (Beginner)
    By jamez05 in forum C Programming
    Replies: 0
    Last Post: 08-11-2005, 07:05 AM
  5. Beginner on Win32 apps, lame question.
    By Templario in forum C Programming
    Replies: 3
    Last Post: 11-06-2002, 08:39 PM