GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rating: Thread Rating: 2 votes, 5.00 average.
  #1  
Old 01-Jun-2005, 03:29
Debugger1 Debugger1 is offline
New Member
 
Join Date: Jun 2005
Location: Greece Thessaloniki
Posts: 8
Debugger1 is on a distinguished road
Angry

Visual Studio .NET 2003 problem in executing C source files


I have recently installed Visual Studio .NET 2003 (due to the fact that I was experiencing linking problems with VS 6.0) . It didnt take long to understand that C programs couldnt be executed that easily in VS 2003 compared to VS6.0. Build and debug options from the menu where gray-unavailable, after that i tried a few things but still nothing happened!

I think that if there is nothing wrong with my configurations then propably c programs in VS2003 have to be called first in a project file.

If u have any clue help!
  #2  
Old 01-Jun-2005, 03:35
LuciWiz's Avatar
LuciWiz LuciWiz is offline
Moderator
 
Join Date: Jul 2004
Location: Cluj-Napoca (Romania)
Posts: 1,032
LuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the rough
Quote:
Originally Posted by Debugger1
I have recently installed Visual Studio .NET 2003 (due to the fact that I was experiencing linking problems with VS 6.0) . It didnt take long to understand that C programs couldnt be executed that easily in VS 2003 compared to VS6.0. Build and debug options from the menu where gray-unavailable, after that i tried a few things but still nothing happened!

I think that if there is nothing wrong with my configurations then propably c programs in VS2003 have to be called first in a project file.

If u have any clue help!

No, it's the same thing, only a bit more ANSI compliant

Please tell us what you did: did you try building an old VC 6 project, or did you make a new project? What kind was it: console application, or what?
If you'll fill us in on the details, I'm sure we'll get this fixed very quickly.

You could try building a new Console application and running it - that's simple and should work.
BTW, we are talking about VC projects, right?

Best regards,
Lucian
__________________
Please read these Guidelines before posting on the forum

"A person who never made a mistake never tried anything new."
Einstein
  #3  
Old 01-Jun-2005, 03:50
Debugger1 Debugger1 is offline
New Member
 
Join Date: Jun 2005
Location: Greece Thessaloniki
Posts: 8
Debugger1 is on a distinguished road
Quote:
Please tell us what you did: did you try building an old VC 6 project, or did you make a new project? What kind was it: console application, or what?

No I am trying to edit and run a simple algorythm (with custom libraries) made in VS6.0, not a project, for a my 1rst semster.



my programs have a ".c" extention and they are like this one :

CPP / C++ / C Code:
/*
 * File: add2.c
 * ------------
 * This program reads in two numbers, adds them together,
 * and prints their sum.
 */

#include <stdio.h>
#include "genlib.h"
#include "simpio.h"

main()
{
    int n1, n2, total;

    printf("This program adds two numbers.\n");
    printf("1st number? ");
    n1 = GetInteger();
    printf("2nd number? ");
    n2 = GetInteger();
    total = n1 + n2;
    printf("The total is %d.\n", total);
}
Last edited by LuciWiz : 01-Jun-2005 at 05:01. Reason: Please insert your C code between [c] & [/c] tags
  #4  
Old 01-Jun-2005, 05:22
LuciWiz's Avatar
LuciWiz LuciWiz is offline
Moderator
 
Join Date: Jul 2004
Location: Cluj-Napoca (Romania)
Posts: 1,032
LuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the rough
Oh, I see.

Well, you'll need a project in VC 6 too, the difference is that it will create it for you when you try to execute the program.
Just hit File->New->Project and select the project type to be a Visual C Console Application.
Give it a name - in this case let's call it add2. It will generate some files for you, amongst which you will find add2.cpp. Replace this file with your own, either by renaming yours to .cpp or by deleting this one from the project and adding yours in place (you can do this in the "Solution Explorer" pane, located at the left or the right in your IDE).
You can run your application now.

Unfortunately, when building this kind of application I believe you need to include the all-hated stdafx.h at the beginning of the file (you can't change the default which is set to "use precompiled headers").

You just do this right now so you can run your application, and then decide what kind of project you need.

Best regards,
Lucian
__________________
Please read these Guidelines before posting on the forum

"A person who never made a mistake never tried anything new."
Einstein
  #5  
Old 01-Jun-2005, 05:46
Debugger1 Debugger1 is offline
New Member
 
Join Date: Jun 2005
Location: Greece Thessaloniki
Posts: 8
Debugger1 is on a distinguished road
Quote:
Originally Posted by LuciWiz
Oh, I see.

Well, you'll need a project in VC 6 too, the difference is that it will create it for you when you try to execute the program.
Just hit File->New->Project and select the project type to be a Visual C Console Application.
Give it a name - in this case let's call it add2. It will generate some files for you, amongst which you will find add2.cpp. Replace this file with your own, either by renaming yours to .cpp or by deleting this one from the project and adding yours in place (you can do this in the "Solution Explorer" pane, located at the left or the right in your IDE).
You can run your application now.

Unfortunately, when building this kind of application I believe you need to include the all-hated stdafx.h at the beginning of the file (you can't change the default which is set to "use precompiled headers").

You just do this right now so you can run your application, and then decide what kind of project you need.

Best regards,
Lucian



I did what u told me to do but the file created by this is a .cpp file. Unfortunately I cannot #include my libraries in c++(I couldnt in VS6.0 and i still cant ) I tried renaming the extension of the given file but nothing happened, also nothing happened when I created a new file add2.c in folder.

I think that somehow VS 2003 doent support C programming. U can do projects using C++, C# and J#, but u cannot make a project using C!!!


Anyway I really apreciate your help and interest.
  #6  
Old 01-Jun-2005, 05:58
LuciWiz's Avatar
LuciWiz LuciWiz is offline
Moderator
 
Join Date: Jul 2004
Location: Cluj-Napoca (Romania)
Posts: 1,032
LuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the rough
Quote:
Originally Posted by Debugger1
I did what u told me to do but the file created by this is a .cpp file. Unfortunately I cannot #include my libraries in c++(I couldnt in VS6.0 and i still cant ) I tried renaming the extension of the given file but nothing happened, also nothing happened when I created a new file add2.c in folder.

I think that somehow VS 2003 doent support C programming. U can do projects using C++, C# and J#, but u cannot make a project using C!!!

No, no, you can!

Please read my instructions carefully.
Actually, let me offer a better explanation, I can be really evasive sometimes

Look for a pane with a tree like architecture; it should have at least 3 tabs: Solution Explorer, Class View and Resource View. Switch to Solution Explorer and your will see the files "belonging" to the project. *Remove* add2.cpp from the project and then add (you can right-click on the project name and select Add->Add Existing item and browse to your C file). Your C file will be added to the project.
Add
CPP / C++ / C Code:
#include "stdafx.h"

at the top of your C file and run your project now.

P.S: You could rename the file right there in the project from add.cpp to add.c by right-clicking on it (in the same pane) and selecting Rename. Then, copy and paste the code from the original file to this one.

I hope this works!

Best regards,
Lucian
__________________
Please read these Guidelines before posting on the forum

"A person who never made a mistake never tried anything new."
Einstein
  #7  
Old 01-Jun-2005, 06:29
Debugger1 Debugger1 is offline
New Member
 
Join Date: Jun 2005
Location: Greece Thessaloniki
Posts: 8
Debugger1 is on a distinguished road

Re:


That was close


here is my error from debug:
\Documents and Settings\Akis.MICROSOF-D94CDE\Desktop\add2.c(1) : fatal error C1853: 'Debug/Add2.pch' precompiled header file is from a previous version of the compiler, or the precompiled header is C++ and you are using it from C (or vice versa)


The file I added is made with C(it's extension is .c) but it is displayed in solution manager just as if it was in c++! I think that the problem is that this project doesnt support c source.
  #8  
Old 01-Jun-2005, 06:45
LuciWiz's Avatar
LuciWiz LuciWiz is offline
Moderator
 
Join Date: Jul 2004
Location: Cluj-Napoca (Romania)
Posts: 1,032
LuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the rough
Quote:
Originally Posted by Debugger1
That was close


here is my error from debug:
\Documents and Settings\Akis.MICROSOF-D94CDE\Desktop\add2.c(1) : fatal error C1853: 'Debug/Add2.pch' precompiled header file is from a previous version of the compiler, or the precompiled header is C++ and you are using it from C (or vice versa)


The file I added is made with C(it's extension is .c) but it is displayed in solution manager just as if it was in c++! I think that the problem is that this project doesnt support c source.

Yeah, you got that because the stdafx crap is a .cpp file.
OK, new plan - and better, I promise

Create a new Console application, but this time when you get the options window (before the project is generated), you will see on the left 2 categories: Overview and Application Settings. Click the former and select the option Empty Project.
This way you don't have to include the Microsoft specific stdafx and you can just add your file to the project. Finally!

Sorry I didn't figure it out before...

Best regards,
Lucian
__________________
Please read these Guidelines before posting on the forum

"A person who never made a mistake never tried anything new."
Einstein
  #9  
Old 01-Jun-2005, 07:09
Debugger1 Debugger1 is offline
New Member
 
Join Date: Jun 2005
Location: Greece Thessaloniki
Posts: 8
Debugger1 is on a distinguished road
Where are these options?

I cannot find the overview and Application settings, i thought they were on the new project menu but they arent
  #10  
Old 01-Jun-2005, 07:14
LuciWiz's Avatar
LuciWiz LuciWiz is offline
Moderator
 
Join Date: Jul 2004
Location: Cluj-Napoca (Romania)
Posts: 1,032
LuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the rough
Quote:
Originally Posted by Debugger1
Where are these options?

I cannot find the overview and Application settings, i thought they were on the new project menu but they arent

Right after you enter the name for the project and click OK, doesn't a window pop-up? You should find these options on the left side of this window.
__________________
Please read these Guidelines before posting on the forum

"A person who never made a mistake never tried anything new."
Einstein
 
 

Recent GIDBlogToyota - 2009 May Promotion by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Introduction to .NET LuciWiz .NET Forum 5 09-Aug-2007 05:53
Checking source codes of image, audio and video files onauc C Programming Language 5 26-Feb-2005 22:47
What is "Ambigious symbol" ??*( a compilation error) small_ticket C++ Forum 2 07-Jan-2005 22:10
Having a problem Chuckles Computer Hardware Forum 19 13-Sep-2004 13:17
web server in secure mode not connecting to http application tcsasp Apache Web Server Forum 0 06-Nov-2003 01:08

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 18:19.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.