The C++ WTF why doesn't it work?!?! thread

thatbloke

Junior Administrator
The comma (as I am led to believe by my boss) tells it to set all members of the array to the same as what you put in before the comma.

That's a load of bollox.

The comma like that initialises the rest of the memory to 0 (null values), not what you had in before the comma.

But still damned handy :)
 

Wol

In Cryo Sleep
Code:
Error	1	error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup	MSVCRTD.lib

Retarded errors. 'fixing' it, just causes a different similar error to pop up.

And then I go round in circles, as I never remember how I fix it.
 

thatbloke

Junior Administrator
Any chance of seeing some code?

It looks like there is either a library missing in your linker paths or you are using an incorrect/wrong version of a library, which is expecting a particular symbol within another library but it isnt actually there...
 
E

elDiablo

Guest
To me it looks like you haven't correctly defines the main function or entry point of the program, with the whole ___tmainCRTStartup part in there.
 
E

elDiablo

Guest
Class A has a function prototype, void FunctionB(), in it's header file. The prototype is never implemented, but is never called anyway. The code compiles fine, and runs. If FunctionB is ever called, any objects (including Class A) that call that function will compile fine (as the prototype exists), but will fail to link, as the function doesn't really exist (no code is made for it). This gives a compile time error, and I think this is what is happening here. It could be anything from a typo to different/incorrect parameter types (which would also give a "this function isn't defined in the header file" type error if you are using member functions, otherwise it would give nothing extra) to just not writing the function.

I think that's your problem at the moment.
 

Wol

In Cryo Sleep
Its something to do with my setup for visual studio. If i copy the solution file from a working project, and add the same code to it, it compiles fine. I can never remember which combination of options i need though. *sigh*

I now have a bit of broken code which sees purple as orange *sigh*

oh well.

Another thing i had was that i had a compiler moaning about "void FunctionName();" as a prototype. Stupid thing wanted a "void" in the brackets. :cool:
 
E

elDiablo

Guest
...Another thing i had was that i had a compiler moaning about "void FunctionName();" as a prototype. Stupid thing wanted a "void" in the brackets. :cool:

That would be the strictest type of C/C++ (though for some reason I think it's mostly a C thing...) which is trying to make you follow the standards as much as possible. If you're using VS though, I would not have expected you to see that problem...
 

Wol

In Cryo Sleep
The compiler I'm using is technically only C89, so you do have to stick the voids in.

If you're using VS though, I would not have expected you to see that problem...

For the retarded error I was getting earlier, I was using VS as the IDE and compiler, however for the thing where it was moaning about the lack of voids, I'm using VS as the IDE, but using a different compiler.
 
Top