Quantcast
Channel: Visual C forum
Viewing all 15302 articles
Browse latest View live

Revisit: LINK : fatal error LNK1149: output filename matches input filename

$
0
0

We are attempting to move several projects from VS6 to VS2008 and upgrade to x64.  We are encountering the error:

LINK : fatal error LNK1149: output filename matches input filename

when we attempt to build our DLL.  The following is the linker command created by VS2008:

/OUT:"e:\ast_soft\Soft_image\Solid\UniGr\UG_Nuform\x64\UG_NUFORM_dll.dll" /INCREMENTAL:NO /NOLOGO /NODEFAULTLIB:"msvcrt.lib" /MANIFEST /MANIFESTFILE:"e:\ast_soft\Soft_image\Solid\UniGr\UG_Nuform\x64\UG_NUFORM_dll.dll.intermediate.manifest" /IMPLIB:"e:\ast_soft\Soft_image\Solid\UniGr\UG_Nuform\x64\UG_NUFORM_dll_lib.lib" /DLL kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib "C:\Program Files\Siemens\NX 9.0\UGOPEN\libopenpp.lib" "C:\Program Files\Siemens\NX 9.0\UGOPEN\libvmathpp.lib" "C:\Program Files\Siemens\NX 9.0\UGOPEN\libufun.lib" e:\ast_soft\soft_image\String_DEC\x64\String_DEC.lib

NOTE:

  1. The output file is UG_NUFORM_dll.dll
  2. The implib is UG_Nuform_dll_lib.lib
  3. There are no duplicate file names.

It appears that the linker is doing things that are not explicitly stated.  We do not see any possible workarounds.


Error: expected a ')'

$
0
0

Disregard this.  I'm dumb.  The Boolean operator is &&.  Not and.

I'm writing a simple program, just started learning C++.  I get the error at the bold comment, and I'm not sure where the compiler wants the ')'

#include <iostream>
using namespace std;

int main() {
//Declare variables
int quarters, nickels, dimes, pennies, dollars, cents;

//prompt user for coins
cout << "How many Quarters?\n";
cin >> quarters;
cout << "How many dimes?\n";
cin >> dimes;
cout << "How many nickels?\n";
cin >> nickels;
cout << "How many pennies?\n";
cin >> pennies;

//calculate total cents, find dollars and remaining cents.
cents = (quarters * 25) + (dimes * 10) + (nickels * 5) + pennies;
dollars = cents / 100;
cents = cents % 100;

if ((dollars == 0) and (cents == 0)) //The and here gives me the error.
{
cout << "No input of coins.";
}


How to embed build date, but only if build was actually needed

$
0
0

This is a build related question.  I'd like to get the build date burned into the executable somehow, but there's a catch, I only want the date to change when a build was necessary.

What doesn't work for me is using the __DATE__ macro, because it only gets recompiled if the source file containing the __DATE__ macro changes.

I'd basically like something that happens only when the build produces new output. (Only when the linker runs maybe?)  If somethingelse changes, then I want a new date.  But if the only thing that is different is the date, then Idon't want to cause it to rebuild. (I could use Rebuild All to trigger that.)

Any ideas?

(edit): I should also mention that I don't want my solution to be always "out of date".  And I only want a new date when it is indeed "out of date" (in the Visual Studio Build Solution sense).


EETypeLoadException

$
0
0

Hi

I’ll migrate a VC++ 6.0 MFC solution to VC++ 2005 (managed c++). My solution consists of one exe-file which call’s some MFC extension DLL’s and some MFC extension DLL’s.

After I compile the code with "/clr" I get the "Loader Lock" Error on some DLL Main function’s. I have fixed the Loader Lock" Error by the manuals of MSDN library, but now I get these errors when I debug the code:


' myprogramm.exe' (Managed): Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC80.DebugCRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_f75eb16c\msvcm80d.dll', Symbols loaded.

' myprogramm.exe': Loaded 'C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\System\455eebc099ae6c4bbe3920886da8b72d\System.ni.dll', No symbols loaded.

'myprogramm.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

First-chance exception at 0x7c81eb33 (kernel32.dll) in myprogramm.exe: Microsoft C++ exception: EETypeLoadException at memory location 0x0012d324..

First-chance exception at 0x7c81eb33 (kernel32.dll) in myprogramm.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000..
First-chance exception at 0x7c81eb33 (kernel32.dll) in myprogramm.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000..
First-chance exception at 0x7c81eb33 (kernel32.dll) in myprogramm.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000..
First-chance exception at 0x7c81eb33 (kernel32.dll) in myprogramm.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000..
First-chance exception at 0x7c81eb33 (kernel32.dll) in myprogramm.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000..

A first chance exception of type 'System.IO.FileLoadException' occurred in myprogramm.exe

An exception of type 'System.IO.FileLoadException' occurred in myprogramm.exe but was not handled in user code

Additional information: Could not load file or assembly 'myprogrammDLL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=xxxxxx0d40ceb5cc' or one of its dependencies. Could not find or load a type. (Exception from HRESULT: 0x80131522)

A first chance exception of type '<CrtImplementationDetails>.ModuleLoadException' occurred in msvcm80d.dll

First-chance exception at 0x7c81eb33 (kernel32.dll) in StabCS.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000..

An unhandled exception of type 'System.TypeInitializationException' occurred in Unknown Module.

Additional information: The type initializer for '<Module>' threw an exception.

Any Ideas how to fix the error?

How can I Get parent thread ID of a thread

$
0
0
hi,

I have Question regarding Threads, How can I Get parent thread ID of a thread.
I want to list descendant threads of a thread that has been created by some other process.
I have parent thread Id but not able to map child -parent relation ship between the threads.
Any help really appreciated.

Thanks,
Sachin

c1xx : fatal error C1027: Inconsistent values for /Ym between creation and use of precompiled header

$
0
0
I'm trying to port C++ applications that built with VS 2005 to VS 2008.  I'm using a build procedure that invokes VS from the command line many times using the devenv command.  On my own computer, I get the C1027 error building a project.  The same project works properly on other machines and works OK on my machine if I build it from inside the IDE.  Any suggestions for a fix or workaround?

Second, what does this error message mean?  I can't find any documentation on the /Ym command line switch for the C++ compiler.

control CPU performance and core usage

$
0
0

Hi,

 I have created a multithread program which containg 4000 threads,While running CPU usage goes to 100% and system goes hang condition,Kindly help me to control CPU Performance  and core

Thanks

Navaneethakrishnan.S

Shlwapi.lib is not static linked when x64 is targeted in Solution Platforms in Microsoft Visual Studio 2015 Professional in Visual C++

$
0
0

According to the title says, When I target x64 in Solution Platforms, I cannot use any Shlwapi function anymore, such as PathFileExists, PathRemoveFileSpec, PathRemoveExtension, PathFindFileName and etc.

I still can #include <Shlwapi.h> and intellisense show me the name of the functions. Before I build solution, I doNOT have any error that say that Shlwapi functions that I use are undefined, but after I build solution, I get error that say that the functions are only forward declared, but not implemented. When the code file's extension isc, then the error I get is:

"unresolved external symbol __imp_Shlwapi function name referenced in function main"

and "1 Unresolved externals"

And when the code file's extension is cpp, then the error I get is:

"missing type specifier - int assumed. Note C++ does not support default-int".

But when I target x86 in both c and cpp, the build succeeds without any error.

Only in x86 I can use Shlwapi functions directly (there is static link to Shlwapi.lib), but in x64 the only way to use Shlwapi functions is to dynamic link them, because there is no static link to Shlwapi.lib. And I don't want to dynamic link Shlwapi.lib via code. Why x64 is problematic and x86 is not?


S-Box in C [2] Simplified [ Question ]

$
0
0

 This is the previous thread i have made but it was full of Confusion

S-Box typically like rows and cols. and it's basically substitution table. 

Instead of get the whole s-box in my code ( 2 tables ) i want to get a C code 

which will work as S-box and Calculate like S-box substitution table !

I already found a code which you give you guys a basic idea but in this code snippet

i am not sure how it's calculating rows and cols. The Code as follows >>

void initialize_aes_sbox(uint8_t sbox[256]) {
	/* loop invariant: p * q == 1 in the Galois field */
	uint8_t p = 1, q = 1;
	do {
		/* multiply p by x+1 */
		p = p ^ (p << 1) ^ (p & 0x80 ? 0x1B : 0);
		/* divide q by x+1 */
		q ^= q << 1;
		q ^= q << 2;
		q ^= q << 4;
		q ^= q & 0x80 ? 0x09 : 0;
		/* compute the affine transformation */
		sbox[p] = 0x63 ^ q ^ ROTL8(q, 1) ^ ROTL8(q, 2) ^ ROTL8(q, 3) ^ ROTL8(q, 4);
	} while (p != 1);
	/* 0 is a special case since it has no inverse */
	sbox[0] = 0x63;
}
  

I am familiar with For loop one inside another to make rows and cols but above snippet is confusing.

I hope this this you will be able to help me. 

Thanks

Find Runtime Library mismatch

$
0
0

Hi.

i have a project that uses several libraries. At linking time I'm having problems regarding some mismatch of Runtime Library option in the libraries. 

How can I tell how every library was compiled (MD or MT)?

thank you

Alternatives to Polling for Completion of Schedule task?

operator overloading using template cannot be compiled in Visual Studio 2012/2013

$
0
0

Hi,

I got a problem when migrate some work from Visual Studio 2010 to Visual Studio 2012. It seems like the issue is operator overloading using template cannot be compiled in Visual Studio 2012/2013. The error message is 

Error1 error C2678: binary '+=' : no operator found which takes a left-hand operand of type 'unsigned __int64' (or there is no acceptable conversion)D:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xutility

But it compiles fine in Visual Studio 2010 and 2015 and it is also fine with g++.

I looked around online, only find something similar 

http://stackoverflow.com/questions/29594986/c-curious-compiler-error-when-implementing-a-function-int-nextstdstring-p

Does anyone knows the problem and suggest me a workaround for this?

Thanks in advance,

Best regards,

Edit: I solved the problem by remove the template of the operator overloading between the real matrix and the complex matrix, now it seems compiled in VS2012.

Developing Face Detection / identification Software [ Question ]

$
0
0

How can i make a Face detection / Identification software? 

 

Platform: Windows 

Language : C++ WInAPI 

 

Thanks 

Unexpected endif when compiling source

$
0
0

I hope this is the correct group.  I'm using the Visual Studio 2010 compiler for some C++ code.  This code base is shared with Windows and Linux.  In order to make the process of adding files to the code base easier (mostly in Linux), we're moving to wrapping the entire file into a conditional compilation block if the code in the particular file is Windows or Linux only.  So, for example, I have several files which contain code relevant to Windows only.  So, I've done this:

#ifdef _WIN32
#include "path/to/Precompiled.h"

/* lots of code here */

#endif

gcc was happy with this, but then again this file isn't being compiled in Linux.  However, when I compile in Windows using VS 2010, I get the error, "Unexpected endif ...," from the compiler.  If this one small, but significant change is made, VS is happy

#include "path/to/Precompiled.h"
#ifdef _WIN32

/* lots of code */
#endif

It is somehow tied to the fact that precompiled headers are being used.  Please help me to understand why.

Thanks.

c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afxcoll.h(590): error C2248: 'CObject::operator =' : cannot access private member declared in class 'CObject'

$
0
0

#pragma once #include "stdafx.h" #define MAX_TEAM_MEMBERS 6 #define MAX_TEAMS 6 #define MAX_ROW_SQUARES 20 typedef CArray<CStatic*, CStatic*> CStaticArray; class CTeamType: public CObject { public: CTeamType() { m_nTeamMemberIndex = m_nTeamBoardPos = 0; }; CTeamType(const CTeamType& rNew) { *this = rNew; }; ~CTeamType() { m_arrayTeamMembers.RemoveAll(); m_arrayRow.RemoveAll(); }; CTeamType& operator =(const CTeamType& rNew) { m_arrayTeamMembers = rNew.m_arrayTeamMembers; m_arrayRow = rNew.m_arrayRow; m_nTeamMemberIndex = rNew.m_nTeamMemberIndex; m_nTeamBoardPos = rNew.m_nTeamBoardPos; }; CStringArray m_arrayTeamMembers; UINT m_nTeamMemberIndex, m_nTeamBoardPos; CStaticArray m_arrayRow; }; typedef CArray<CTeamType, CTeamType&> arrayTeamType;

Above is the declaration of a data type that I am using to create a template CArray data member (m_arrayTeam) in the code below.

I have provided a copy constructor and an assignment operator as here https://msdn.microsoft.com/en-us/library/ccb3dh5c.aspx

However I am still getting the following error when I compile.

If I change CStatic* to void* I get exactly the same compile error.

What am I missing here?

1>  Game.cpp
1>c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afxcoll.h(590): error C2248: 'CObject::operator =' : cannot access private member declared in class 'CObject'
1>          c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afx.h(536) : see declaration of 'CObject::operator ='
1>          c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afx.h(510) : see declaration of 'CObject'
1>          This diagnostic occurred in the compiler generated function 'CStringArray &CStringArray::operator =(const CStringArray &)'
1>c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afxtempl.h(262): error C2248: 'CObject::operator =' : cannot access private member declared in class 'CObject'
1>          c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afx.h(536) : see declaration of 'CObject::operator ='
1>          c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afx.h(510) : see declaration of 'CObject'
1>          This diagnostic occurred in the compiler generated function 'CArray<TYPE,ARG_TYPE> &CArray<TYPE,ARG_TYPE>::operator =(const CArray<TYPE,ARG_TYPE> &)'
1>          with
1>          [
1>              TYPE=CStatic *,
1>              ARG_TYPE=CStatic *
1>          ]
1>  BoardDlg.cpp
1>c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afxcoll.h(590): error C2248: 'CObject::operator =' : cannot access private member declared in class 'CObject'
1>          c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afx.h(536) : see declaration of 'CObject::operator ='
1>          c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afx.h(510) : see declaration of 'CObject'
1>          This diagnostic occurred in the compiler generated function 'CStringArray &CStringArray::operator =(const CStringArray &)'
1>c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afxtempl.h(262): error C2248: 'CObject::operator =' : cannot access private member declared in class 'CObject'
1>          c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afx.h(536) : see declaration of 'CObject::operator ='
1>          c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afx.h(510) : see declaration of 'CObject'
1>          This diagnostic occurred in the compiler generated function 'CArray<TYPE,ARG_TYPE> &CArray<TYPE,ARG_TYPE>::operator =(const CArray<TYPE,ARG_TYPE> &)'
1>          with
1>          [
1>              TYPE=CStatic *,
1>              ARG_TYPE=CStatic *
1>          ]
1>  Generating Code...

void CBoardDlg::ConfirmTeams()
{
	//typedef struct
	//{
	//	CStringArray m_arrayTeamMembers;
	//	UINT m_nTeamMemberIndex, m_nTeamBoardPos;
	//	CArray<CStatic*, CStatic*> m_arrayRow;
	//}
	//structTeamType;

	//typedef CArray<structTeamType, structTeamType&> arrayTeamType;
	UINT nCol = 0, nRow = 0;
	CStatic *pNextSquare = (CStatic*)GetDlgItem(IDC_STATIC_A1);

	while (pNextSquare)
	{
		ASSERT_VALID(pNextSquare);
		if (pNextSquare)
		{
			if (!pNextSquare->IsKindOf(RUNTIME_CLASS(CStatic)))
				break;
			else
			{
				if (nCol == MAX_ROW_SQUARES)
				{
					m_arrayTeams[nRow].m_nTeamBoardPos = 0;
					nCol = 0;
					nRow++;
				}
				else
					nCol++;

				m_arrayTeams[nRow].m_arrayRow.Add(pNextSquare);
				pNextSquare = (CStatic*)GetNextDlgTabItem(pNextSquare);
			}
		}
	}
}



Control CPU core

$
0
0

Hi,

how to set user created threads should be run in following core 1357 in 8 core Machine.

Thanks,

Naveen.S

Face Tracking /Face Detection

$
0
0

Face Tracking on WeBcam or In a Video FIle ? 

How do i do that ? 

Intialization of OpenGL rendering context in MFC Application

$
0
0

Dear All,

I have tabbed style MFC window created by the wizard VC2015 , I'm planning to use it to initilize the OPenGL rendering context and let rendering be in those child tabbed windows. I still have the difficulty with MFC architecture, so in which class or source file do I need to initialize/swap the handles of rendering context of OPenGL and windowed childs ? I tried to initialize that in ChildFrm.cpp OnCreate event, but nothing gets rendered correctly and from time to time it raises "Assertation fault". 

Based on that, I thought that ChildFrm.cpp is not right place to start, your guidance will be appreciated,

Regards,

function returning void pointer, dll problem

$
0
0
Hi all,

a would like to create DLL. the part of code causing problems looks like this:

#ifdef DLLDIR_EX 
#define DLLDIR  __declspec(dllexport)   // export DLL information 
 
#else 
#define DLLDIR  __declspec(dllimport)   // import DLL information 
 
#endif  
 
#include "embed.h" 
#include "FF30BrowserListener.h" 
 
extern "C" { 
    void* DLLDIR CreateMozViewClassInstance(); 
}; 
 

The compiler is not satisfied with the void* return type. The error is: error C2059: syntax error : '__declspec(dllexport)'. This error occurs only with functions returning pointers (no matter what type). Could you please post some advice if you knew what is the problem. Thank you in advance.

Process Explorer - what EXACTLY does the info in the Handles pane mean?

$
0
0

I'm looking for a handle leak and trying to get some help from process explorer. The Handles pane contains entries such as this which (I suspect) are related to the leaked handles:

TYPE   NAME   HANDLE

Thread RVECON.exe(8572): 9008      0x1440

8572 us the process ID and is not all that helpful

9008 appears to be a thread ID (e.g. as returned by beginThreadEx()) although note that it frequently references a thread which is NO LONGER RUNNING.

1440 is (obviously) a HANDLE. Its worth noting that this is NOT the handle returned by beginThread when the thread 9008 was started.

So my question is what EXCTLY does all this mean? In particular why does a thread that is no longer running show up? and what exactly does that handle ID mean? Does the thread refer to the thread that CREATED that handle perhaps? (Which would explain why there is an entry for a thread that has exited). But if so why is it a handle of type thread? What then does type=Thread actually mean about the handle?

Anyway - with all due respect and in order to keep the 'noise level' down I'd appreciate a reply from someone who actually knows (or at least is reasonably sure about) the answer rather than a lot of 'helpful' guesswork. I can (and did) make educated guesses about this already (e.g. that the handle in PE was the one returned by beginthread when the thread was created) and they have mostly turned out to be wrong...


Al Chisholm

Viewing all 15302 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>