Thread: Error with external symbol?

  1. #1
    Registered User
    Join Date
    Dec 2009

    Error with external symbol?

    For some reason I keep getting the following error:
    error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup

    I'm sure it's a quick fix but I can't find a way around it. I tried re creating the project because I know sometimes that works, but it didn't.

    Here's the code.

    #include "stdafx.h"
    #include <cstdlib>
    #include <ctime>
    #include <iostream>
    using namespace std;
    void fct() 
    int arr[10];
    int * aptr = arr;
    srand((unsigned int)time(0));
    for (aptr = arr; aptr<=&arr[9];aptr++)
    *aptr = rand() % 41;
    cout << *aptr << '\t' << aptr << endl;
    Please help me fix it. I'm almost done!

  2. #2
    Join Date
    Oct 2007
    Inside my computer
    You haven't created a main function! Every C++ program needs a main function, otherwise it won't run.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 02:28 PM
  3. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 05:44 PM
  4. debug to release modes
    By DavidP in forum Game Programming
    Replies: 5
    Last Post: 03-20-2003, 03:01 PM
  5. Linking error
    By DockyD in forum C++ Programming
    Replies: 10
    Last Post: 01-20-2003, 05:27 AM