Thread: Problem with V C++

  1. #1
    Registered User
    Join Date
    Apr 2002

    Problem with V C++

    I have this program, if I run it under Dev-C++ it runs berfect, but if I try to run it under V c++ it gives me an error message.

    this is the code
    //project 5 Order status
    float spools_orderd;
    float spools_in_stock;
    bool special_c = false;
    void getData()
    	char y;
    	cout<<" Please enter the Number of spools orderd: " ;
    	cin>> spools_orderd;
    	cout<<" Please enter the Number of Spools in Stuck: " ;
    	cin>> spools_in_stock;
    	cout<<" IS there any special charge? (Y = yes): ";
    	if ((y= 'Y')|| (y='y')){
    		special_c = true;
    void display()
    	float ready_spools_in_stock;
    	float spools_in_back_order;
    	float portion_ready;
    	float total_s_and_h_charge;
    	float total_charge;
    	float special_charges =10;
    	//geting the special charge if there is any
    	if (special_c == true) {
    		cout<<" Please enter the special shipping and handling charges (normaly it is $10) :" ;
      	    cin>> special_charges;
    	//calculating the spools in the order and sub it from the stock
    	if ( spools_in_stock >= spools_orderd) {
    		ready_spools_in_stock= spools_orderd;
    		spools_in_stock = spools_in_stock - spools_orderd;
    		spools_in_back_order = 0;
    	}else {
    		ready_spools_in_stock = spools_in_stock;
    		spools_in_back_order = spools_orderd - spools_in_stock;
    		spools_in_stock = 0;
    	//calculating the portion ready to ship.
    	portion_ready = ready_spools_in_stock * 100;
    	//calculating the shipping & handling charges
    	total_s_and_h_charge = special_charges * ready_spools_in_stock;
    	//calculating the total order ready to ship
    	total_charge = total_s_and_h_charge + portion_ready;
    	//displaying the resluts.
    	cout<< " The Number of spools ready to ship in stock are: ";
    	cout<< ready_spools_in_stock<< "spools"<<endl;
    	cout<<" The Number of spools on back-order is:";
    	cout<< spools_in_back_order<< endl;
    	cout<<" Subtotal of the portion ready to ship : $ ";
    	cout<< portion_ready<<endl;
    	cout<< " The total shipping and handling charges on the portion ready to ship $";
    	cout<< total_s_and_h_charge<<endl;
    	cout<<" The total  of the order ready to ship is : $ ";
    	cout<< total_charge<<endl;
    int main()
       return 0;
    This is the error message:
    --------------------Configuration: p4 - Win32 Debug--------------------
    LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
    Debug/p4.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.

    p4.exe - 2 error(s), 0 warning(s)

    Thank you for your help.
    The best

  2. #2
    Funniest man in this seat minesweeper's Avatar
    Join Date
    Mar 2002
    Create yourself a new project only this time choose 'console application'. Copy your code in and you should be fine. That message means the compiler is trying to create you a Win32 application, you picked the wrong setting when you made the project.

  3. #3
    Registered User
    Join Date
    Apr 2002

    Got you...

    I hope that this is the problem,
    let me try it.
    The best

  4. #4
    Registered User
    Join Date
    Apr 2002

    Got it

    that was the problem.

    That is right,
    thank you for your help
    The best

  5. #5
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Hannover, Germany
    In addition, have a close look at this line:

    if ((y= 'Y')|| (y='y')){

    I don't think it works the way you intended it.

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM