Sign in to follow this  

3) msvs.net questions

This topic is 4595 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

1) it seems i can only compile and run projects. I want to compile a single source file and run it. Nothing funcy just a hello world program ( it's too small to create a whole new project for it. ) How can i do it? The little blue tringle that stands for "run" is inactive for a single source file :( That IDE doesn't even have a "compile" button somewhere :( All it has is "build" and "run". 2) why when i creatre a new visuall c++ win32 console project the default source file starts with:
// xczcdac.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

int _tmain(int argc, _TCHAR* argv[])
{
	//...
	return 0;
}
why "_tmain" and not just main? why "stdafx.h" and why does it have to build it every time i create/compile the program? the libraries shouldn't be already built for me to just use? And why _TCHAR and not just char as the standard specifies? 3) when i installed msvs.net a shortuct to it wasn't created in my desktop. i created one manually, but why didn't they create the shortcut for me? I installed it normally, basically without changing any options. thanks in advane!

Share this post


Link to post
Share on other sites
1) Create a project, but for the most part, clicking build should create a default project (does for me at least).
2) _tmain is a define that checks if unicode is enabled or not in the build environment. If it is it uses wmain if not it uses main. Instead of creating a project with source files, check the box that says create empty project, and add a source file.
3) It adds them to the start menu.

Share this post


Link to post
Share on other sites
>1) Create a project, but for the most part, clicking build should create a default project (does for me at least).

ok but how do i compile and run a single source file? no projects, just a little hello_world.cpp?

>2) _tmain is a define that checks if unicode is enabled or not in the build environment. If it is it uses wmain if not it uses main. Instead of creating a project with source files, check the box that says create empty project, and add a source file.

o... i see :) ok thank you problem solved, but i already i uninstalled the evil M$ product :)

>3) It adds them to the start menu.
yeah i saw them.. i expected one in the desktop though..

Share this post


Link to post
Share on other sites
you dont compile and run just a source file. you compile and run a project, thats how it is. unless you want to use the command line

[Edited by - chad_420 on May 14, 2005 5:46:41 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by chad_420
you dont compile and run just a source file. you compile and run a project, thats how it is. unless you want to use the command line


what do you mean i don't? How did i do it all the time using Dev-c++? I want to make a program that is consisted by only one source file. Is that so weird? sheesh...

Share this post


Link to post
Share on other sites
Yes, but the compiler and linker need to know what to make from the source file. Will it be a console app, a windows app, a dll, a lib?
This cannot be deduced from the source. That's what the project is: It tells the compiler/linker what files need to be compiled how and any special settings are stored in the project.
You could probably trick the IDE into compiling your .cpp file, but that leaves you with just an .obj file. Which needs to be linked to make something runnable. And it can't just link an object file without knowing more about what you want to do with it.

Share this post


Link to post
Share on other sites
oh... this sucks... Then, how does Dev-cpp know that i am compiling a win32 console app with my source file and not say a dll?

thanks!

Share this post


Link to post
Share on other sites
It guesses. No, really!

VS.NET 2003 doesn't support compiling and running a single file, but I think they've added it to 2005. I don't have 2005 installed at the moment to check, cause I unstalled beta 1 in anticipation of beta 2 (which hasn't arrived at my house yet) :)

Share this post


Link to post
Share on other sites

This topic is 4595 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this