|
Hi all!
I have a .lib file which has all the necessary functions which are written in ANSI C. I wanted to use these functions in C#. So I decided to include and use them in a class library file which is to be written in C++ (VS.NET-Class library proj., right? ), then import this class library to my real C# project. So,I have inluded all the include files, library file to my project. But when I try to compile it I end up with the error:
""error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup""
my .h file:
// uFWrapper.h
#pragma once
public __gc class uFWrapperClass
{
public:
uFWrapperClass();
~uFWrapperClass();
void TestFunc();
};
my .cpp file:
// This is the main DLL file.
#include "stdafx.h"
#include "uFWrapper.h"
#include <stdio.h>
using namespace System;
#include "allapi.h" //Necessary inc
#include "log.h" //files
#include "serial.h" //for functions
#include "command.h" //in
#include "config.h" //.lib
#include "module.h" //file
#if defined(TOOL_WIN32)
#define NOGDI
#include <windows.h>
#endif
uFWrapperClass::uFWrapperClass() //construct
{
}
uFWrapperClass::~uFWrapperClass() //destruct
{
}
void uFWrapperClass::TestFunc()
{
int rangeStart = 0x990;
int rangeEnd = 0x999;
UAIdentify(&rangeStart, &rangeEnd); //when this line is include
//i end up with error. This func is in .lib
}
What am I doing wrong?
|
|
|
|
|
Alper KARS wrote:
But when I try to compile it I end up with the error:
""error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup""
Try changing the substystem in the linker options from Console (/SUBSYSTEM:CONSOLE) to Windows (/SUBSYSTEM:WINDOWS).
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
I have also tried it. But it did not worked for me I think the problem is releated to the .lib file I am trying to use. It seems to be compiled with VS6. In VS6 we could import .lib files to the project from the "Add File..." menu. Is there some way to import .lib files in VS.NET to the VC++ projects? As I have read there is noway to import .lib files to C# projs. (Correct, right?)And thanks for your suggestion by the way.
|
|
|
|
|
I am a VC user, now I use VC6.0, but this many a day , I am troubled by the Visual C++ 6.0 IDE's BOOKMARK question.
As you know ,you can use short cut key <Alt> + F2 to add a bookmark to your project, or you can use short cut key <Ctrl> + F2 to add a color marked bookmark to your project. I am used to the first method to add a bookmark to my VC project.
But long ago , I have sadly found that I couldn't add any bookmark to my project! I use short cut key<Alt> + F2 to activate the "bookmark" dialog, I input the name of my bookmark, such as MyBookMark, and then I click "Add" button to add a new bookmark to my project ,but unfortunately, the below bookmark list has no reflection, i.e, my newly added bookmark can't be seen in the bookmark lists now! however I do, I only find that I can't add any new bookmark to my project!!!
Why this happened ??? I am eager to know the reason and how to solve the troublesome problem.
no pains no gains.
|
|
|
|
|
This is a known issue. Bookmarks will work for the duration of the file/project. Once the file containing the bookmark or the project is closed, the bookmark(s) goes away.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
A known issue ? I want to know whether some progress has been made for this subject in VS.NET 2003
or later version of VS ? Is there really no better way to solve this bug ? In the days when computer technology has been upgrated rapidally, I think such technique question is out of question for so famous company ---MICROSOFT , but why Microsoft hasn't correct this troublesome bug??? puzzling...
Hold up.
|
|
|
|
|
It is really a troublesome bug, many people can't bother it and saying it is so big a bug of MICROSOFT.
|
|
|
|
|
Hi,
I'm converting a project originally written in VC++ 5.0 using MFC. This framework tends to use the uppercase BOOL, TRUE and FALSE for boolean type. The later frameworks include the lowercase bool, true and false as the boolean type. You can't use them together or you will face compiler warnings about performance drop due to converting.
So the question is simple: What to use?
Whats the difference?
Wich is better, and on what field?
Regards,
Kurt Pattyn
codito ergo sum
|
|
|
|
|
small 'bool', its a primitive data type like int,char..etc and accepts only 0 and 1 ... anything above 1 say..2,3,4 taken as 1 only.
BOOL is basically of int type so accepts any values other than 0 and 1..
i think its better to use bool.
hey this is my finding!!.. wait for better responses..
V
|
|
|
|
|
BadKarma wrote:
Whats the difference?
bool is a type builtin C++ (standarized) and BOOL is defined by Microsoft and it's an int (defined in 'windef.h'). An important difference is their size: if you perform a "sizeof" for a bool, it's 1, and in a win32 platform a BOOL has 4 bytes.
BadKarma wrote:
So the question is simple: What to use?
Depends on what you need, if you need something more portable or just a binary variable I'd choose bool if you need a wide range of values then BOOL.
BadKarma wrote:
Wich is better, and on what field?
I prefer bool because it's a c++ standard and when I need a wide range of values I use an int.
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
marcdev wrote:
...if you need a wide range of values then BOOL.
By its very definition, a boolean variable only has two values: 0 and 1. Anything beyond that and you no longer have a boolean variable.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Yep !!! Completely agree
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
In theory yes, but in practice no. Anytime you are using a non-Boolean to represent a Boolean value, you have to be careful how you test for TRUE or FALSE. For example "if (x == TRUE)" is a VERY bad idea since it yields different results than "if (x)".
Now using this information that a BOOL can have four billion different values and returning more results than just TRUE(!=0) or FALSE(==0) is a bad bad thing. (Which is the case I am sure you are referencing.)
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
well actually you can convert them.
The main difference is that a BOOL is actually an integer (4 bytes I think) and TRUE and FALSE are defined values to 1 and 0 respectively.
a bool is a class I think, where the data integrety (true/false) is forced more then the BOOL datatype.
(a little warning: bool can have a sort of tri-state, never use something like the following:
bool mybool;<br />
<br />
<br />
if(mybool == true){
}<br />
else{<br />
}
but use
if(mybool){
}<br />
else{<br />
/code<br />
}
)
both types are used often. BOOL is especially used on structures like:
BOOL myBOOL;<br />
<br />
if(myBOOL == TRUE){<br />
<br />
}<br />
else{<br />
if(myBOOL == 3){<br />
<br />
}<br />
else{<br />
}<br />
}<br />
}
I'll leave it up to you whether you find this good or bad design.
I hope this helps you a bit.
good luck!
No hurries, no worries.
|
|
|
|
|
In your MFC code, stick to BOOL. For everything else (within reason), move towards bool.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
100% agreed. And never compare a BOOL to TRUE, only check if it is FALSE or not. Since anything that is not FALSE is TRUE.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
I want to write a Visual C++ program which gets data from the user and gives this data to GAMS (on a simple button click and GAMS should not run visibly). GAMS is then supposed to make a calculation and give the obtained data back to my Visual C++ program so that I can use this new data. Does anybody know if this is possible???? And if so, then how should I do this? THANKS in advance.
|
|
|
|
|
Two type definitions are used in borZoi can anyone explain it to me.
1.typedef unsigned char OCTET;
This represents an unsigned 8 bit type. It is called octet rather than
byte in order to be consistent with the various standards.
2.typedef std::vector<octet> OCTETSTR;
This is a vector of octets and represents an octet string as described in various standards.
|
|
|
|
|
What's the question?
"God doesn't play dice" - Albert Einstein
"God not only plays dice, He sometimes throws the dices where they cannot be seen" - Niels Bohr
|
|
|
|
|
using typedef allow you to define synonyms.
you use it just as you would define a variable of that type, but the name of the variable is the synonym name...
<font color=green>
<font color=blue>typedef unsigned char</font> OCTET;
<font color=green>
<font color=green>
<font color=blue>typedef</font> vector<OCTET> OCTETSTR;
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
by definition an octet is 8 "something".
octet is the (better) french translation of a byte; maybe the original programmers were french.
as for the other one, maybe we're missing < >
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
we want to transefer one file from one pc to another.
please give me code in VC++.
when we run any Windows program in VC++ linking error was arise.
error was like . unresolved symbol : _beginthreadex
unresolved symbol : _endthreadex
in some library file.
|
|
|
|
|
manishgandhi wrote:
when we run any Windows program in VC++ linking error was arise.
error was like . unresolved symbol : _beginthreadex
unresolved symbol : _endthreadex
in some library file.
I Believe you forget to Enable MFC in your Project!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
manishgandhi wrote:
we want to transefer one file from one pc to another.
please give me code in VC++.
How? RS-232, tcp, ... ?
manishgandhi wrote:
when we run any Windows program in VC++ linking error was arise.
error was like . unresolved symbol : _beginthreadex
unresolved symbol : _endthreadex
That's bcause you are compiling with /MT flag activated (multithread option)and your libc.lib seems that it doesn't support it. Do you have this library? Read this[^] for info.
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
I am currently wokring on the server side applications of the project and i am using Visual Studio .NET and MFC to develop the server side applications. As for the server's user interface i am using MFC and my server's side user interface will receive the summary page from the client which is send by the customer using the Pocket PC to send the summary page. The summary page is the finalised orders made by the customers and it consists of the name of the food ordered, number of drinks, what type of desserts and including the special orders made by the customers. I am actually doing a project on the ordering of foods and my part is responsible for receiving the summary page which is the finalised food orders from the customers using the Pocket PC and my difficulties is how to program some intelligence in the server so that for eg .it can calculate the accumulated orders of the total of how many plates of chicken chops are ordered and how many drinks and dessert are ordered, pls help me i am really stuck!! yr help is very much appreciated
Claude
|
|
|
|