Welcome to Dream.In.Code
Become a C++ Expert!

Join 137,187 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,297 people online right now. Registration is fast and FREE... Join Now!




VC Debug Folder? Exe not found

 
Reply to this topicStart new topic

VC Debug Folder? Exe not found

baconbeastnz
30 May, 2008 - 05:35 PM
Post #1

New D.I.C Head
*

Joined: 29 May, 2008
Posts: 21

Error 1 error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup MSVCRTD.lib 2dhouse
Error 2 fatal error LNK1120: 1 unresolved externals C:\Users\william\Documents\Visual Studio 2008\Projects\2dhouse\Debug\2dhouse.exe 2dhouse

unable to start program: c:/e.t.c/doc/visual09/myprog/deub/myprog.exe

WTF! what is this debug folder for. here is my code:

cpp
#ifdef WIN32
#pragma comment(lib, "SDL.lib")
#pragma comment(lib, "SDLmain.lib")
#pragma comment(lib, "SDL_image.lib")
#endif

#include "stdafx.h"
#include <windows.h>
#include <GL/glut.h>
#include <gl/gl.h>
#include <gl/glu.h>
#include <gl/glut.h>

#include <SDL.h>
#include <SDL_opengl.h>

#define TRUE 1
#define FALSE 0



const int windowWidth=300;
const int windowHeight=400;


const int numVertices=5;
const int numEdges=6;
const float vertices[numVertices][2] = {{0.0,0.0},{100.0,0.0},{0.0,100.0},{100.0,100.0},{50.0,150.0}};
const int edges[numEdges][2] = {{0,1},{1,3},{3,2},{2,0},{2,4},{3,4}};
const int edges2[4][2] = {{0,2},{2,3},{3,1},{1,0}};


LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);

class SpaceShip {
int x, y, SpaceShipWidth;
public:
void move_ship (int x,int y ) {
//displace xy
}
void set_values (int shipWidth, int xCoord, int yCoord) {
SpaceShipWidth = shipWidth;
x = xCoord;
y = yCoord;
}


};

void setStartValues(void) {
SpaceShip ship;
ship.set_values(50, (windowWidth / 2) - 50,windowHeight - 40);


}



void display(void)
{

glClear(GL_COLOR_BUFFER_BIT);


glColor3f (1.0, 0.0, 0.0);
glPointSize(3.0);

glBegin(GL_LINES);

for(int i=0;i<numEdges;i++)
{
glVertex2fv(vertices[edges[i][0]]);
glVertex2fv(vertices[edges[i][1]]);

}

glEnd();

//glDrawPixels(checkImageWidth, checkImageHeight, GL_RGB,
//GL_UNSIGNED_BYTE, checkImage);


glFlush ();
}

void init(void)
{

glClearColor (0.246, 0.33, 0.422, 0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
GLdouble halfWidth=(GLdouble) windowWidth/2.0;
GLdouble halfHeight=(GLdouble) windowHeight/2.0;
gluOrtho2D(0, windowWidth, windowHeight, 0);

}

void keyboard (unsigned char key, int x, int y) {
switch (key) {

case GLUT_KEY_LEFT :
break;

case GLUT_KEY_UP :
break;

case GLUT_KEY_RIGHT :
break;

case GLUT_KEY_DOWN :
break;

}
}


int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(windowWidth, windowHeight);
glutInitWindowPosition(100, 100);
glutCreateWindow("My first OpenGL program");
init ();
glutDisplayFunc(display);
glutKeyboardFunc (keyboard);

setStartValues();

glutMainLoop();
return 0;



}

User is offlineProfile CardPM
+Quote Post

Cerolobo
RE: VC Debug Folder? Exe Not Found
30 May, 2008 - 05:43 PM
Post #2

D.I.C Regular
Group Icon

Joined: 5 Apr, 2008
Posts: 440



Thanked: 31 times
My Contributions
Your deceleration of main() is incorrect. The correct forms of main() are

int main(void)

or

int main(int argc, char *argv[])

Just change int main(int argc, char** argv) to int main(int argc, char *argv[])
User is offlineProfile CardPM
+Quote Post

baconbeastnz
RE: VC Debug Folder? Exe Not Found
30 May, 2008 - 05:50 PM
Post #3

New D.I.C Head
*

Joined: 29 May, 2008
Posts: 21

thx tried that, didnt work..
User is offlineProfile CardPM
+Quote Post

Cerolobo
RE: VC Debug Folder? Exe Not Found
30 May, 2008 - 05:54 PM
Post #4

D.I.C Regular
Group Icon

Joined: 5 Apr, 2008
Posts: 440



Thanked: 31 times
My Contributions
What did the compiler tell you when modified it? That should have fixed it.
User is offlineProfile CardPM
+Quote Post

skaoth
RE: VC Debug Folder? Exe Not Found
30 May, 2008 - 09:30 PM
Post #5

D.I.C Regular
Group Icon

Joined: 7 Nov, 2007
Posts: 344



Thanked: 10 times
Dream Kudos: 100
My Contributions
Don't know if this will help but this is what VS2k5 generates as is main. I don't know what kind of program you set up

console
int _tmain(int argc, _TCHAR* argv[])

GUI App
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)


there is also a way to setup the entry point to the program with VS.

Project->Properties.
Select Configuration Properties->Linker->Advanced.
You should see something called "Entry Point".

Lastly
QUOTE
Just change int main(int argc, char** argv) to int main(int argc, char *argv[])
Why would the compiler think there is a difference here? It was my understanding that char** and char *[] under the context of a function parameter

QUOTE

ISO C++ 98
After determining the type of each parameter, any parameter of type ``array of T'' or ``function returning T'' is adjusted to be ``pointer to T'' or ``pointer to function returning T,'' respectively.





User is offlineProfile CardPM
+Quote Post

perfectly.insane
RE: VC Debug Folder? Exe Not Found
31 May, 2008 - 02:29 AM
Post #6

D.I.C Addict
Group Icon

Joined: 22 Mar, 2008
Posts: 558



Thanked: 46 times
Dream Kudos: 25
Expert In: C/C++

My Contributions
QUOTE(skaoth @ 30 May, 2008 - 10:30 PM) *

console
int _tmain(int argc, _TCHAR* argv[])

GUI App
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)


_tmain and _tWinMain are macros that expand to main or wmain and WinMain or wWinMain, depending on the status of UNICODE and/or _UNICODE.

Using main should still work, provided that the aforementioned definitions are not set.

Also, the entry point option is probably there to specify the initial entry point, which is normally someplace in the C runtime library... not the entry-point from the user-perspective (i.e. main, which is called by the C runtime library). If one were to change this, one would probably have to do quite a bit of work to split command line parameters and other potentially required initialization steps.

char*[] and char** should be the same in the context of a function parameter. Moreover, if the symbol name isn't mangled (does not have proto information embedded in the symbol name), the linker would never know the difference between main(int argc, char** argv) and main(int x, int y).

This post has been edited by perfectly.insane: 31 May, 2008 - 02:30 AM
User is offlineProfile CardPM
+Quote Post

KYA
RE: VC Debug Folder? Exe Not Found
31 May, 2008 - 03:04 AM
Post #7

#include <nerd.h>
Group Icon

Joined: 14 Sep, 2007
Posts: 5,049



Thanked: 124 times
Dream Kudos: 1200
My Contributions
Since its a windows app int main() should not be used, WinMain() should be instead, regardless of unicode macro _t
User is online!Profile CardPM
+Quote Post

perfectly.insane
RE: VC Debug Folder? Exe Not Found
31 May, 2008 - 08:02 AM
Post #8

D.I.C Addict
Group Icon

Joined: 22 Mar, 2008
Posts: 558



Thanked: 46 times
Dream Kudos: 25
Expert In: C/C++

My Contributions
QUOTE(KYA @ 31 May, 2008 - 04:04 AM) *

Since its a windows app int main() should not be used, WinMain() should be instead, regardless of unicode macro _t


It's purely related to the /SUBSYSTEM linker flag. If it's /SUBSYSTEM:CONSOLE, then it's main/wmain, and for /SUBSYSTEM:WINDOWS, then it's WinMain/wWinMain. CONSOLE apps can use GUI functions, and WINDOWS apps can use console functions... it's just a matter of whether or not a console is allocated for the application on startup.
User is offlineProfile CardPM
+Quote Post

born2c0de
RE: VC Debug Folder? Exe Not Found
31 May, 2008 - 11:51 AM
Post #9

printf("I'm a %XR",195936478);
Group Icon

Joined: 26 Nov, 2004
Posts: 3,914



Thanked: 34 times
Dream Kudos: 2800
Expert In: 80x86 Assembly, C/C++, VB6, VB.NET, C#, J2SE, Win32 API, Reversing

My Contributions
QUOTE
Your deceleration of main() is incorrect.
The correct forms of main() are
int main(void)
or
int main(int argc, char *argv[])
Just change int main(int argc, char** argv) to int main(int argc, char *argv[])

Both forms are identical.
char **argv is the same as char *argv[]
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/4/08 11:41AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month