How do I make a project in Visual Studio?

I usually write source code with notepad and compile with MinGW on the command line due to my disdain for complex GUIs. I'm trying to change my ways. So I'm trying to debug an unstable program I wrote. (I don't know what the problem is other than that it usually will crash the first time you try to run it. It works fine for me, albeit slowly other times.). Its important I figure out how to get it to work in Visual Studio because my teacher uses that to compile project and if it doesn't work there, (even if it works with GCC) I get a 0. She gave me a chance to redo the assignment because she's nice. She got the code to compile but it won't run at all.

On google docs: (How awesome is google docs???)

https://docs.google.com/folder/d/0B4UPOuCR5uRGQnlEa19VUWkzek0/edit

First I created a new project, I previously installed an allegro template so it already links to alld.lib.

Path to the project is: C:\Users\dancks\Desktop\Module8VC

I put lightshow.h, lightshow.cpp and main.cpp all in Module8VC\Module8VC and pics in Module8VC\Module8VC\pics. These files weren't created in VS: I cp'ed from another location since I wrote them previously. Don't know if that is important.

I notice that unless I go to file->open lightshow.h and lightshow.cpp don't appear. They aren't listed in the solution explorer. I don't have that problem with main.cpp because I simply replaced it with another one I guess. But when I go to class and click that weird icon thingy class lightshow appears with methods and variables listed along with a private struct declared inside the class.

I press "build" and this is what I get:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
1
1>Deleting intermediate and output files for project 'module8VC', configuration 'Debug|Win32'
1>Compiling...
1>main.cpp
1>c:\program files\microsoft visual studio 8\vc\include\allegro\internal\alconfig.h(409) : warning C4312: 'type cast' : conversion from 'unsigned int' to 'unsigned char *' of greater size
1>c:\program files\microsoft visual studio 8\vc\include\allegro\internal\alconfig.h(416) : warning C4312: 'type cast' : conversion from 'unsigned int' to 'unsigned char *' of greater size
1>c:\program files\microsoft visual studio 8\vc\include\allegro\inline\draw.inl(437) : warning C4312: 'type cast' : conversion from 'unsigned int' to 'unsigned char *' of greater size
1>c:\program files\microsoft visual studio 8\vc\include\allegro\inline\draw.inl(451) : warning C4312: 'type cast' : conversion from 'unsigned int' to 'unsigned char *' of greater size
1>c:\program files\microsoft visual studio 8\vc\include\allegro\inline\draw.inl(462) : warning C4312: 'type cast' : conversion from 'unsigned int' to 'unsigned short *' of greater size
1>c:\program files\microsoft visual studio 8\vc\include\allegro\inline\draw.inl(476) : warning C4312: 'type cast' : conversion from 'unsigned int' to 'unsigned short *' of greater size
1>c:\program files\microsoft visual studio 8\vc\include\allegro\inline\draw.inl(487) : warning C4312: 'type cast' : conversion from 'unsigned int' to 'unsigned short *' of greater size
1>c:\program files\microsoft visual studio 8\vc\include\allegro\inline\draw.inl(501) : warning C4312: 'type cast' : conversion from 'unsigned int' to 'unsigned short *' of greater size
1>c:\program files\microsoft visual studio 8\vc\include\allegro\inline\draw.inl(537) : warning C4312: 'type cast' : conversion from 'unsigned int' to 'unsigned int *' of greater size
1>c:\program files\microsoft visual studio 8\vc\include\allegro\inline\draw.inl(551) : warning C4312: 'type cast' : conversion from 'unsigned int' to 'unsigned int *' of greater size
1>Linking...
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall lightshow::clear(void)" (?clear@lightshow@@QAEXXZ) referenced in function "int __cdecl _mangled_main(int,char * * const)" (?_mangled_main@@YAHHQAPAD@Z)
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall lightshow::paint(struct BITMAP *)" (?paint@lightshow@@QAEXPAUBITMAP@@@Z) referenced in function "int __cdecl _mangled_main(int,char * * const)" (?_mangled_main@@YAHHQAPAD@Z)
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall lightshow::init(void)" (?init@lightshow@@QAEXXZ) referenced in function "int __cdecl _mangled_main(int,char * * const)" (?_mangled_main@@YAHHQAPAD@Z)
1>main.obj : error LNK2019: unresolved external symbol __imp___install_allegro_version_check referenced in function "int __cdecl _mangled_main(int,char * * const)" (?_mangled_main@@YAHHQAPAD@Z)
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall lightshow::lightshow(void)" (??0lightshow@@QAE@XZ) referenced in function "void __cdecl `dynamic initializer for 'sh''(void)" (??__Esh@@YAXXZ)
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall lightshow::~lightshow(void)" (??1lightshow@@QAE@XZ) referenced in function "void __cdecl `dynamic atexit destructor for 'sh''(void)" (??__Fsh@@YAXXZ)
1>Debug\module8VC.exe : fatal error LNK1120: 6 unresolved externals
1>Build log was saved at "file://c:\Users\dancks\Desktop\module8VC\module8VC\Debug\BuildLog.htm"
1>module8VC - 7 error(s), 10 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
Update: Something curious I noted:
Whenever I try to save a file to a project, instead of opening to the project folder it takes me to C:\users\dancks\My Documents\Microsoft Visual Studio 2005\Projects even though there is nothing there except some stray folder called "VCMacros80" and a stray source file. Maybe its normal behavior to open here but I find it bizarre it wouldn't take me to the open project folder? Obviously there is a screwed up setting in MSVC8 thats doing this but is it possible to edit one of the generated files like .sln or .vcproj so I can make sure its reading from the proper folder?
i dont get it what you wana say but from the subject line i guess that you want to make a project in vs..
and also you want to Access it after what you made..
its simple......

Create a new project:

On the File menu, point to New, then click Project….

From the Visual C++ project types, click Win32, then click Win32 Console Application.

Enter a project name.

By default, the solution that contains the project has the same name as the new project, though you can enter a different name. You can enter a different location for the project if you wish.

Click OK to create the new project.

In the Win32 Application Wizard, select Empty Project and click Finish.

If Solution Explorer is not visible, click Solution Explorer on the View menu.

Add a new source file to the project:

Right-click on the Source Files folder in Solution Explorer and point to Add and click New Item.

Click C++ File (.cpp) from the Code node, enter a file name, and then click Add.

The .cpp file appears in the Source Files folder in Solution Explorer and a tabbed window appears where you type in the code.

Click in the newly created tab in Visual Studio and type in a valid C++ program that uses the Standard C++ Library, or copy and paste one of the sample programs.

For example, you can use the set::find (STL Samples) sample program in the Standard Template Library Samples topics in the help. See How to: Compile a Code Example from the Help Topics for information on copying a sample program to the Clipboard.

If you use the sample program for this procedure, notice the using namespace std; directive. This allows the program to use cout and endl without requiring fully qualified names (std::cout and std::endl).

On the Build menu, click Build Solution.

The Output window displays information about the compilation progress, such as the location of the build log and a message indicating that the build succeeded.

On the Debug menu, click Start without Debugging.

If you used the sample program, a command window is displayed that shows whether certain integers are found in the set.

lightshow::clear(), lightshow::paint() etc have apparently not been defined (probably because you haven't linked all the required files).

To import files you have already written to your VS project you can right-click on the Solution Explorer's folders (source files, header files etc) and choose to "add -> existing item", this will open a file browser window and alow you to find the .cpp and .h files needed and add them to the solution.

Also make sure that: Project -> (Project Name's) Properties -> Configuration Properties -> Include Directories (and Library Directories) are properly updated, and that Project -> (Project Name's) Properties -> Configuration Properties -> Linker -> Additional Dependencies is updated (listing all the lib files you need).
Last edited on
Topic archived. No new replies allowed.